diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-09-24 12:53:51 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-09-27 11:19:19 -0300 |
commit | be9883b09d05b90c2422502f38ab69081e29e4ce (patch) | |
tree | c5bff33e41b9566495b91c7908ab421628497c6e /activemodel | |
parent | eff68d86adce12f8c850fcd810f18a81ef53c0eb (diff) | |
download | rails-be9883b09d05b90c2422502f38ab69081e29e4ce.tar.gz rails-be9883b09d05b90c2422502f38ab69081e29e4ce.tar.bz2 rails-be9883b09d05b90c2422502f38ab69081e29e4ce.zip |
Don't redefine existing attributes accessors.
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/validations/confirmation.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/validations/confirmation.rb b/activemodel/lib/active_model/validations/confirmation.rb index 2c8a840124..00df10cef0 100644 --- a/activemodel/lib/active_model/validations/confirmation.rb +++ b/activemodel/lib/active_model/validations/confirmation.rb @@ -10,7 +10,9 @@ module ActiveModel 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 |