diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 4 | ||||
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index df9c66aa08..bfa932c5b8 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -692,9 +692,7 @@ module ActiveRecord else records_to_save = association.select{ |record| record.new_record? } end - records_to_save.inject(true) do |result,record| - result &&= record.valid? - end + records_to_save.all? { |record| record.valid? } end end_eval end diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index ecc192247a..6481e37a25 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -589,7 +589,7 @@ module ActiveRecord validates_each(attr_names, configuration) do |record, attr_name, value| record.errors.add(attr_name, configuration[:message]) unless - (value.is_a?(Array) ? value : [value]).inject(true) { |memo, r| (r.nil? or r.valid?) and memo } + (value.is_a?(Array) ? value : [value]).all? { |r| r.nil? or r.valid? } end end |