diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-08-28 23:15:47 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-08-28 23:15:47 +0000 |
commit | 5cbc782ecef16f256f543fa444dc1380925cefc0 (patch) | |
tree | 022b60afcfbb9175348ac85230b1f1396be546ee /activerecord | |
parent | 016947ceedfb43a864ea4ef57d97366ab2825785 (diff) | |
download | rails-5cbc782ecef16f256f543fa444dc1380925cefc0.tar.gz rails-5cbc782ecef16f256f543fa444dc1380925cefc0.tar.bz2 rails-5cbc782ecef16f256f543fa444dc1380925cefc0.zip |
Remove unnecessary loop in validates_presence_of. [sur] Closes #9392
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7362 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index f3d9e20360..adf6c290c7 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -490,13 +490,11 @@ module ActiveRecord # can't use validates_each here, because it cannot cope with nonexistent attributes, # while errors.add_on_empty can - attr_names.each do |attr_name| - send(validation_method(configuration[:on])) do |record| - unless (configuration[:if] && !evaluate_condition(configuration[:if], record)) || (configuration[:unless] && evaluate_condition(configuration[:unless], record)) - record.errors.add_on_blank(attr_name,configuration[:message]) - end - end - end + send(validation_method(configuration[:on])) do |record| + unless (configuration[:if] && !evaluate_condition(configuration[:if], record)) || (configuration[:unless] && evaluate_condition(configuration[:unless], record)) + record.errors.add_on_blank(attr_names, configuration[:message]) + end + end end # Validates that the specified attribute matches the length restrictions supplied. Only one option can be used at a time: |