Form helpers and overloaded methods - help!

Brian,

I have the same problem. I don’t have an answer for you but I think the
more
appropriate place to modify the code is at (line after !!! comment):

def to_input_field_tag(field_type, options = {})
options = options.stringify_keys
options[“size”] ||= options[“maxlength”] ||
DEFAULT_FIELD_OPTIONS[“size”]
options = DEFAULT_FIELD_OPTIONS.merge(options)
if field_type == “hidden”
options.delete(“size”)
end
options[“type”] = field_type

!!! options[“value”] ||= value_before_type_cast unless field_type ==

“file”
options[“value”] ||= value unless field_type == “file”
add_default_name_and_id(options)
tag(“input”, options)
end

I have a suspicion that value_before_type_cast was used for things that
don’t
degrade well to a string after type casting.

What is interesting is it appears that the typical form processing is
not
symmetrical, when I instantiate an object using the form parameters when
processing the submit, it does go through the overridden methods.

For now, I have made the above change in my development environment and
am
continuing to test with it.

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs