I have the following callback and method in my Customer
model.
before_save :convert_commission_percentage
def convert_commission_percentage
self.commission= commission.to_f/100.to_f
end
This allows the user to input a percentage as 45
and store it as .45
. However, on edit, the field for this percentage is then displayed as .45
on the edit form, causing that number to be divided by 100 again on update. Is there a way to keep this from happening by displaying the edit field as 45
?