How can I convert user number input from something like 11,5 to 11.5?
I have tried the following as callback:
before_validation :comma_to_delimiter
def comma_to_delimiter
self.price.to_s.gsub(',', '.').to_f
end
But this doesn't work. I want the user to be able to type in whatever he wants as delimiter - currently, the app throws an error when the user uses a comma instead of a point.