The text_field method sets the class of the field to “invalid” when the
you specified is invalid (when using validations). This is to facilitate
working with validations.
Is there anything else it does? In a certain non-standard situation I’m
to use text_field_tag, instead of text_field. This means I have to take
of the validations myself as well. Everything goes fine, except that
enter text in fields that can only take numbers, the contents of the
“0” when you re-render the action, instead of the text you entered. In
of the application where we use text_field, the erronious contents of
field is preserved on re-rendering of the action.
I don’t do anything differently when extracting the contents of the
Also, the part of the app where it goes OK, I tested what the type of
ActiveRecord field was. It was a float. So it would appear that
takes the value of the field from somewhere else when the object is not
because that erronious text could not have come from a float. Is this
so, where? I can’t seem to find it.