Skip to content
Browse files

FormHelper should only use *_before_type_cast if they available on th…

…e model

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 69cb942 commit dad37cfafa65a9f0ed2d0db6473c1d6b323dcdfe @dhh dhh committed Dec 19, 2004
Showing with 6 additions and 1 deletion.
  1. +5 −1 actionpack/lib/action_view/helpers/form_helper.rb
  2. +1 −0 activerecord/lib/active_record/base.rb
View
6 actionpack/lib/action_view/helpers/form_helper.rb
@@ -192,7 +192,11 @@ def value
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
View
1 activerecord/lib/active_record/base.rb
@@ -532,6 +532,7 @@ def column_methods_hash
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

0 comments on commit dad37cf

Please sign in to comment.
Something went wrong with that request. Please try again.