aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-09-21 21:14:04 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-09-21 21:14:04 +0100
commit340be9bddd8e5902e0218a0101a40a17a4afd558 (patch)
treeef4de25f3f8eb610dc2235f0762b01cb1d464efd /activemodel/lib/active_model/validations
parentb31cdb55422226cd45a2234a4b54986f1f611151 (diff)
parent1bbb9b2db05730194edfd7d2cef9f5fcb9d79e50 (diff)
downloadrails-340be9bddd8e5902e0218a0101a40a17a4afd558.tar.gz
rails-340be9bddd8e5902e0218a0101a40a17a4afd558.tar.bz2
rails-340be9bddd8e5902e0218a0101a40a17a4afd558.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'activemodel/lib/active_model/validations')
-rw-r--r--activemodel/lib/active_model/validations/presence.rb2
-rw-r--r--activemodel/lib/active_model/validations/with.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb
index 72d6b1c6f0..3ff677c137 100644
--- a/activemodel/lib/active_model/validations/presence.rb
+++ b/activemodel/lib/active_model/validations/presence.rb
@@ -32,7 +32,7 @@ module ActiveModel
# can't use validates_each here, because it cannot cope with nonexistent attributes,
# while errors.add_on_empty can
- send(validation_method(configuration[:on]), configuration) do |record|
+ validate configuration do |record|
record.errors.add_on_blank(attr_names, configuration[:message])
end
end
diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb
index 851cdfebf0..edc2133ddc 100644
--- a/activemodel/lib/active_model/validations/with.rb
+++ b/activemodel/lib/active_model/validations/with.rb
@@ -51,7 +51,7 @@ module ActiveModel
def validates_with(*args)
configuration = args.extract_options!
- send(validation_method(configuration[:on]), configuration) do |record|
+ validate configuration do |record|
args.each do |klass|
klass.new(record, configuration.except(:on, :if, :unless)).validate
end