aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations/with.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-05-23 10:00:52 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-05-23 10:00:54 -0300
commit9e5b8e3831552a103b2dcf8de75fb6a2337d42ba (patch)
treeef7f47142b07726fc2c7a954d400a9c1ef7558e5 /activemodel/lib/active_model/validations/with.rb
parent30d28b19584783218e842ce2fd7bfe2bc1dccf66 (diff)
parent7d84c3a2f7ede0e8d04540e9c0640de7378e9b3a (diff)
downloadrails-9e5b8e3831552a103b2dcf8de75fb6a2337d42ba.tar.gz
rails-9e5b8e3831552a103b2dcf8de75fb6a2337d42ba.tar.bz2
rails-9e5b8e3831552a103b2dcf8de75fb6a2337d42ba.zip
Merge branch 'deprecate-validator-setup'
Closes #10716
Diffstat (limited to 'activemodel/lib/active_model/validations/with.rb')
-rw-r--r--activemodel/lib/active_model/validations/with.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb
index 2ae335d0f4..16bd6670d1 100644
--- a/activemodel/lib/active_model/validations/with.rb
+++ b/activemodel/lib/active_model/validations/with.rb
@@ -83,9 +83,10 @@ module ActiveModel
# end
def validates_with(*args, &block)
options = args.extract_options!
+ options[:class] = self
+
args.each do |klass|
validator = klass.new(options, &block)
- validator.setup(self) if validator.respond_to?(:setup)
if validator.respond_to?(:attributes) && !validator.attributes.empty?
validator.attributes.each do |attribute|