1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

FormHelper should only use *_before_type_cast if they available on the model

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2004-12-19 16:39:56 +00:00
parent 69cb942d9b
commit dad37cfafa
2 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -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