diff options
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 6 | ||||
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index d9a1c7d55e..105f464fc8 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -192,7 +192,11 @@ module ActionView end def value_before_type_cast - object.send(@method_name + "_before_type_cast") unless object.nil? + unless object.nil? + object.respond_to?(@method_name + "_before_type_cast") ? + object.send(@method_name + "_before_type_cast") : + object.send(@method_name) + end end private diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 58a1ac5787..0f07af2d09 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -532,6 +532,7 @@ module ActiveRecord #:nodoc: methods[attr.to_sym] = true methods["#{attr}=".to_sym] = true methods["#{attr}?".to_sym] = true + methods["#{attr}_before_type_cast".to_sym] = true methods end end |