diff options
Diffstat (limited to 'activerecord/lib/active_record/validations.rb')
-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: |