Permalink
Browse files

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...
1 parent 13ad879 commit be8485e77dbc52823dc47ea9a32ec305fcee0895 @arunagw committed Nov 30, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 activemodel/lib/active_model/validations/confirmation.rb
@@ -10,7 +10,9 @@ def validate_each(record, attribute, value)
end
def setup(klass)
- klass.send(:attr_accessor, *attributes.map { |attribute| :"#{attribute}_confirmation" })
+ klass.send(:attr_accessor, *attributes.map do |attribute|
+ :"#{attribute}_confirmation" unless klass.method_defined?(:"#{attribute}_confirmation")
+ end.compact)
end
end

0 comments on commit be8485e

Please sign in to comment.