diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-06-23 17:01:00 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-06-23 17:01:00 +0000 |
commit | 279113f9b31ba6f08ba2489f5f033d269b94f829 (patch) | |
tree | 5b71bafab7a6b244f3c0567b8d367094f1db852d /activerecord/lib/active_record | |
parent | 62a9203a5ed43fb3aea742b887a3bc874352950a (diff) | |
download | rails-279113f9b31ba6f08ba2489f5f033d269b94f829.tar.gz rails-279113f9b31ba6f08ba2489f5f033d269b94f829.tar.bz2 rails-279113f9b31ba6f08ba2489f5f033d269b94f829.zip |
Fixed validates_associated should not stop on the first error (closes #4276) [mrj/manfred/josh]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7094 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 62946bd42c..c2f381e6d1 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -745,7 +745,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]).all? { |r| r.nil? or r.valid? } + (value.is_a?(Array) ? value : [value]).inject(true) { |v, r| (r.nil? || r.valid?) && v } end end |