diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-19 21:05:37 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-19 21:05:37 +1100 |
commit | 2107921000f4a186fed36e676d1ac089c8be1f99 (patch) | |
tree | 42f2188f058f8401d57f0d4c72063689a93e0419 /activerecord/lib/active_record/autosave_association.rb | |
parent | ccb7d9def3c20037c9ed5989d8cae1ed68763f4f (diff) | |
parent | ed8501ef16fb2f5e4bd4d987740f5e5f62978400 (diff) | |
download | rails-2107921000f4a186fed36e676d1ac089c8be1f99.tar.gz rails-2107921000f4a186fed36e676d1ac089c8be1f99.tar.bz2 rails-2107921000f4a186fed36e676d1ac089c8be1f99.zip |
Merge branch 'master' of git://github.com/rails/rails into rails
Diffstat (limited to 'activerecord/lib/active_record/autosave_association.rb')
-rw-r--r-- | activerecord/lib/active_record/autosave_association.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index e178cb4ef2..325a8aa7ec 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -116,14 +116,14 @@ module ActiveRecord # post = Post.find(1) # post.author.name = '' # post.save # => false - # post.errors # => #<ActiveRecord::Errors:0x174498c @errors={"author_name"=>["can't be blank"]}, @base=#<Post ...>> + # post.errors # => #<ActiveRecord::Errors:0x174498c @errors={"author.name"=>["can't be blank"]}, @base=#<Post ...>> # # No validations will be performed on the associated models when validations # are skipped for the parent: # # post = Post.find(1) # post.author.name = '' - # post.save(false) # => true + # post.save(:validate => false) # => true module AutosaveAssociation extend ActiveSupport::Concern @@ -302,7 +302,7 @@ module ActiveRecord association.send(:insert_record, record) end elsif autosave - saved = record.save(false) + saved = record.save(:validate => false) end raise ActiveRecord::Rollback if saved == false @@ -332,7 +332,7 @@ module ActiveRecord key = reflection.options[:primary_key] ? send(reflection.options[:primary_key]) : id if autosave != false && (new_record? || association.new_record? || association[reflection.primary_key_name] != key || autosave) association[reflection.primary_key_name] = key - saved = association.save(!autosave) + saved = association.save(:validate => !autosave) raise ActiveRecord::Rollback if !saved && autosave saved end @@ -355,7 +355,7 @@ module ActiveRecord if autosave && association.marked_for_destruction? association.destroy elsif autosave != false - saved = association.save(!autosave) if association.new_record? || autosave + saved = association.save(:validate => !autosave) if association.new_record? || autosave if association.updated? association_id = association.send(reflection.options[:primary_key] || :id) |