aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-10-10 21:07:53 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2010-10-10 21:13:12 -0200
commitcb26eee54d34eda966b4c9da810b700cce24f824 (patch)
tree4da68eec8328b8b00c4a5f144f71ab509065a973 /actionpack/lib
parentcc8e386d08d83ca1ad0c5da863f588b4c4fbe62c (diff)
downloadrails-cb26eee54d34eda966b4c9da810b700cce24f824.tar.gz
rails-cb26eee54d34eda966b4c9da810b700cce24f824.tar.bz2
rails-cb26eee54d34eda966b4c9da810b700cce24f824.zip
Revert "Make InstanceTagMethods#value_before_type_cast raise if the model don't respond to attr_before_type_cast or attr method"
And "Makes form_helper use overriden model accessors" This reverts commit 3ba8e3100548f10fce0c9784981a4589531476dd and fb0bd8c1092db51888ec4bb72af6c595e13c31fa.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 3cd8b02bc4..b34a74788e 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -1020,14 +1020,9 @@ module ActionView
def value_before_type_cast(object, method_name)
unless object.nil?
- if object.respond_to?(method_name)
- object.send(method_name)
- # FIXME: this is AR dependent
- elsif object.respond_to?(method_name + "_before_type_cast")
- object.send(method_name + "_before_type_cast")
- else
- raise NoMethodError, "Model #{object.class} does not respond to #{method_name}"
- end
+ object.respond_to?(method_name + "_before_type_cast") ?
+ object.send(method_name + "_before_type_cast") :
+ object.send(method_name)
end
end