diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2013-06-03 20:09:33 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2013-06-03 20:09:33 +0200 |
commit | 59caeb6c606cb78b92a24def2bea515c85b2421e (patch) | |
tree | 8399fd996a643f8606233534690fea0b1f8e55f2 /activerecord/lib | |
parent | f9c2f76bea41c4a7ad1419844c6102211787c458 (diff) | |
parent | 75135a97907b4bdeb51eefaaaf8bd35215206fa7 (diff) | |
download | rails-59caeb6c606cb78b92a24def2bea515c85b2421e.tar.gz rails-59caeb6c606cb78b92a24def2bea515c85b2421e.tar.bz2 rails-59caeb6c606cb78b92a24def2bea515c85b2421e.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/autosave_association.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/validations/associated.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 87d4daa6d9..a8a1847554 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -301,7 +301,7 @@ module ActiveRecord def association_valid?(reflection, record) return true if record.destroyed? || record.marked_for_destruction? - unless valid = record.valid?(validation_context) + unless valid = record.valid? if reflection.options[:autosave] record.errors.each do |attribute, message| attribute = "#{reflection.name}.#{attribute}" diff --git a/activerecord/lib/active_record/validations/associated.rb b/activerecord/lib/active_record/validations/associated.rb index 744780d069..b4785d3ba4 100644 --- a/activerecord/lib/active_record/validations/associated.rb +++ b/activerecord/lib/active_record/validations/associated.rb @@ -2,7 +2,7 @@ module ActiveRecord module Validations class AssociatedValidator < ActiveModel::EachValidator #:nodoc: def validate_each(record, attribute, value) - if Array.wrap(value).reject {|r| r.marked_for_destruction? || r.valid?(record.validation_context) }.any? + if Array.wrap(value).reject {|r| r.marked_for_destruction? || r.valid?}.any? record.errors.add(attribute, :invalid, options.merge(:value => value)) end end |