Skip to content
This repository
Browse code

ActiveModel confirmation validator fix fixes #1152

If you have an ActiveModel class that has a 
method email_address_confirmation. 
This method is being overwritten by the 
method defined in the Confirmation validator.
  • Loading branch information...
commit be8485e77dbc52823dc47ea9a32ec305fcee0895 1 parent 13ad879
Arun Agrawal authored November 30, 2011
4  activemodel/lib/active_model/validations/confirmation.rb
@@ -10,7 +10,9 @@ def validate_each(record, attribute, value)
10 10
       end
11 11
 
12 12
       def setup(klass)
13  
-        klass.send(:attr_accessor, *attributes.map { |attribute| :"#{attribute}_confirmation" })
  13
+        klass.send(:attr_accessor, *attributes.map do |attribute|
  14
+          :"#{attribute}_confirmation" unless klass.method_defined?(:"#{attribute}_confirmation")
  15
+        end.compact)
14 16
       end
15 17
     end
16 18
 

0 notes on commit be8485e

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