From cb26eee54d34eda966b4c9da810b700cce24f824 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 10 Oct 2010 21:07:53 -0200 Subject: 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. --- actionpack/lib/action_view/helpers/form_helper.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'actionpack/lib/action_view') 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 -- cgit v1.2.3