Skip to content

Commit

Permalink
ActiveModel confirmation validator fix fixes rails#1152
Browse files Browse the repository at this point in the history
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
arunagw committed Nov 30, 2011
1 parent 13ad879 commit be8485e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion activemodel/lib/active_model/validations/confirmation.rb
Expand Up @@ -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

Expand Down

0 comments on commit be8485e

Please sign in to comment.