aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/autosave_association.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-02-07 16:25:22 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-02-07 16:25:22 -0800
commit08ef06dbf1273fc09d6e23b7d8727928717e8004 (patch)
treec718a7e1b7b61e83d665c7e3583bc575a4d2d707 /activerecord/lib/active_record/autosave_association.rb
parent2b4de6621f75b49c30c03ddd78076f7204cc9577 (diff)
downloadrails-08ef06dbf1273fc09d6e23b7d8727928717e8004.tar.gz
rails-08ef06dbf1273fc09d6e23b7d8727928717e8004.tar.bz2
rails-08ef06dbf1273fc09d6e23b7d8727928717e8004.zip
just return the record from insert_record, use truthiness for comparisons
Diffstat (limited to 'activerecord/lib/active_record/autosave_association.rb')
-rw-r--r--activerecord/lib/active_record/autosave_association.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb
index 9c7bb67479..c52af23fbd 100644
--- a/activerecord/lib/active_record/autosave_association.rb
+++ b/activerecord/lib/active_record/autosave_association.rb
@@ -306,6 +306,8 @@ module ActiveRecord
records.each do |record|
next if record.destroyed?
+ saved = true
+
if autosave && record.marked_for_destruction?
association.destroy(record)
elsif autosave != false && (@new_record_before_save || record.new_record?)
@@ -318,7 +320,7 @@ module ActiveRecord
saved = record.save(:validate => false)
end
- raise ActiveRecord::Rollback if saved == false
+ raise ActiveRecord::Rollback unless saved
end
end