I am using rjust
in a helper function as follows:
def get_child_id(service_name, child_id)
..
return 'FL' + child_id.to_s.rjust(6, "0");
end
The function is being called like so:
<%= get_child_id(@ticket.service_type, @ticket.service_id) %>
and returns FL123456
(123456
being the database value) whereas I would expect FL000000123456
The service_id
is an INT
column in the database.
I use rjust
in my models in the exact same way and it works fine so I'm at a loss why it's not working here, any ideas?
use 12
instead:
def get_child_id(service_name, child_id)
# ...
return 'FL' + child_id.to_s.rjust(12, "0");
end