aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-09-08 15:39:33 -0300
committerEmilio Tagua <miloops@gmail.com>2009-09-08 15:39:33 -0300
commit0489f0c582d2ab70595296f058545b102466bebd (patch)
tree159a85dda7bdb652c93cc05a7ab422283c9f3035 /activemodel/lib/active_model/validations
parent670281c6b2e9b9e8c51a140f2a5f66b251f1b84b (diff)
parentaf5b12c64c878f08336d38e91cc64137a30fb8da (diff)
downloadrails-0489f0c582d2ab70595296f058545b102466bebd.tar.gz
rails-0489f0c582d2ab70595296f058545b102466bebd.tar.bz2
rails-0489f0c582d2ab70595296f058545b102466bebd.zip
Merge commit 'rails/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