diff options
author | Nick Sutterer <apotonick@gmail.com> | 2013-05-13 13:59:28 +1000 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-23 10:00:44 -0300 |
commit | 7d84c3a2f7ede0e8d04540e9c0640de7378e9b3a (patch) | |
tree | ef7f47142b07726fc2c7a954d400a9c1ef7558e5 /activerecord | |
parent | 30d28b19584783218e842ce2fd7bfe2bc1dccf66 (diff) | |
download | rails-7d84c3a2f7ede0e8d04540e9c0640de7378e9b3a.tar.gz rails-7d84c3a2f7ede0e8d04540e9c0640de7378e9b3a.tar.bz2 rails-7d84c3a2f7ede0e8d04540e9c0640de7378e9b3a.zip |
deprecate Validator#setup (to get rid of a respond_to call). validators do their setup in their constructor now.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index a705d8c2c4..52e46e1ffe 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -7,11 +7,7 @@ module ActiveRecord "Pass a callable instead: `conditions: -> { where(approved: true) }`" end super({ case_sensitive: true }.merge!(options)) - end - - # Unfortunately, we have to tie Uniqueness validators to a class. - def setup(klass) - @klass = klass + @klass = options[:class] end def validate_each(record, attribute, value) @@ -34,7 +30,6 @@ module ActiveRecord end protected - # The check for an existing value should be run from a class that # isn't abstract. This means working down from the current class # (self), to the first non-abstract class. Since classes don't know |