The form helper tags currently use value_before_type_cast when populating the value attribute from a model. It seems more in line with expectations that it should use the property from the model that the user can override so the data can be modified between the database and form on load.
Andrew France
Index: actionpack/lib/action_view/helpers/form_helper.rb
===================================================================
--- actionpack/lib/action_view/helpers/form_helper.rb (revision 4457)
+++ actionpack/lib/action_view/helpers/form_helper.rb (working copy)
@@ -250,7 +250,7 @@
options.delete("size")
end
options["type"] = field_type
- options["value"] ||= value_before_type_cast(object) unless field_type == "file"
+ options["value"] ||= value(object) unless field_type == "file"
add_default_name_and_id(options)
tag("input", options)
end
@@ -282,7 +282,7 @@
options["cols"], options["rows"] = size.split("x")
end
- content_tag("textarea", html_escape(options.delete('value') || value_before_type_cast(object)), options)
+ content_tag("textarea", html_escape(options.delete('value') || value(object)), options)
end
def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0")