Hi,
The text_field method sets the class of the field to “invalid” when the
object
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
forced
to use text_field_tag, instead of text_field. This means I have to take
care
of the validations myself as well. Everything goes fine, except that
when you
enter text in fields that can only take numbers, the contents of the
field is
“0” when you re-render the action, instead of the text you entered. In
parts
of the application where we use text_field, the erronious contents of
the
field is preserved on re-rendering of the action.
I don’t do anything differently when extracting the contents of the
object.
Also, the part of the app where it goes OK, I tested what the type of
the
ActiveRecord field was. It was a float. So it would appear that
text_field
takes the value of the field from somewhere else when the object is not
valid,
because that erronious text could not have come from a float. Is this
true? If
so, where? I can’t seem to find it.