aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations/with.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-12-22 23:12:21 +0100
committerJosé Valim <jose.valim@gmail.com>2009-12-22 23:12:21 +0100
commit2476c5312dcbd29f49672f71617a3d34c6a60cc7 (patch)
tree26394dcc6a26a845269c9a004b3960b01fbe693a /activemodel/lib/active_model/validations/with.rb
parent4b8330d2d50ae4de14dd43ffbea4d91804553140 (diff)
downloadrails-2476c5312dcbd29f49672f71617a3d34c6a60cc7.tar.gz
rails-2476c5312dcbd29f49672f71617a3d34c6a60cc7.tar.bz2
rails-2476c5312dcbd29f49672f71617a3d34c6a60cc7.zip
Validator is simply sent to validate method. However, the API needs to change, so validate accepts a record.
Diffstat (limited to 'activemodel/lib/active_model/validations/with.rb')
-rw-r--r--activemodel/lib/active_model/validations/with.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb
index edc2133ddc..8313aded11 100644
--- a/activemodel/lib/active_model/validations/with.rb
+++ b/activemodel/lib/active_model/validations/with.rb
@@ -49,12 +49,10 @@ module ActiveModel
# end
#
def validates_with(*args)
- configuration = args.extract_options!
+ options = args.extract_options!
- validate configuration do |record|
- args.each do |klass|
- klass.new(record, configuration.except(:on, :if, :unless)).validate
- end
+ args.each do |klass|
+ validate klass.new(options.except(:on, :if, :unless)), options
end
end
end