What is the suggested path for dealing with number formats in Rails?

Even if we set locale to pt-BR, for instance, if the user inputs a number like '1.000,00' or '1000,00' in a form input, numerical validation will yield an 'invalid_number' error, even though this is a valid format in Brazil.

I could monkey patch overriding parse_raw_value_as_a_number to replace '.' with '' and ',' with '.' in ActiveModel::Validations::NumericalityValidator but that wouldn't solve the problem because the application is internationalized. So, even if I monkey patch this method, I would have to take into consideration the current user locale before parsing the number...

Are there any plans for supporting this on Rails 3?

Rodrigo.

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to