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:
parent
69cb942d9b
commit
dad37cfafa
2 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue