Skip to content
This repository
Browse code

Revert "Makes form_helper use overriden model accessors backport"

This change introduced breakages and test failures.

This reverts commit 8141f08.
  • Loading branch information...
commit dbbf2fd19c012f68865f797395fdb7191d00dc68 1 parent 9476d62
Michael Koziarski authored
6  actionpack/lib/action_view/helpers/form_helper.rb
@@ -877,9 +877,9 @@ def value(object, method_name)
877 877
 
878 878
         def value_before_type_cast(object, method_name)
879 879
           unless object.nil?
880  
-            object.respond_to?(method_name) ?
881  
-            object.send(method_name) :
882  
-            object.send(method_name + "_before_type_cast")
  880
+            object.respond_to?(method_name + "_before_type_cast") ?
  881
+            object.send(method_name + "_before_type_cast") :
  882
+            object.send(method_name)
883 883
           end
884 884
         end
885 885
 
17  actionpack/test/template/form_helper_test.rb
@@ -91,16 +91,6 @@ def post_attributes=(attributes); end
91 91
 class FormHelperTest < ActionView::TestCase
92 92
   tests ActionView::Helpers::FormHelper
93 93
 
94  
-  class Developer
95  
-    def name_before_type_cast
96  
-      "David"
97  
-    end
98  
-
99  
-    def name
100  
-      "Santiago"
101  
-    end
102  
-  end
103  
-
104 94
   def setup
105 95
     super
106 96
 
@@ -266,13 +256,6 @@ def test_text_field_doesnt_change_param_values
266 256
     assert_equal object_name, "post[]"
267 257
   end
268 258
 
269  
-  def test_text_field_from_a_user_defined_method
270  
-    @developer = Developer.new
271  
-    assert_dom_equal(
272  
-      '<input id="developer_name" name="developer[name]" size="30" type="text" value="Santiago" />', text_field("developer", "name")
273  
-    )
274  
-  end
275  
-
276 259
   def test_hidden_field
277 260
     assert_dom_equal '<input id="post_title" name="post[title]" type="hidden" value="Hello World" />',
278 261
       hidden_field("post", "title")

0 notes on commit dbbf2fd

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