aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-10-16 07:24:23 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-10-16 07:24:23 +0000
commitcfbd790ad3dbb9a5b8ee18b4e386abb412246d9e (patch)
tree4e7e1f42eba1b12725fc3cc4c3e8d12e39fafcef /activerecord/lib/active_record
parent889352835a50f244f9af0ccba94fe7fe3a89daa2 (diff)
downloadrails-cfbd790ad3dbb9a5b8ee18b4e386abb412246d9e.tar.gz
rails-cfbd790ad3dbb9a5b8ee18b4e386abb412246d9e.tar.bz2
rails-cfbd790ad3dbb9a5b8ee18b4e386abb412246d9e.zip
Fix regression where the association would not construct new finder SQL on save causing bogus queries for "WHERE owner_id = NULL" even after owner was saved. Closes #8713.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7942 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 3bf660f7b2..0d440a75fd 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1083,10 +1083,10 @@ module ActiveRecord
[]
end
- if !records_to_save.blank?
- records_to_save.each { |record| association.send(:insert_record, record) }
- association.send(:construct_sql) # reconstruct the SQL queries now that we know the owner's id
- end
+ records_to_save.each { |record| association.send(:insert_record, record) } unless records_to_save.blank?
+
+ # reconstruct the SQL queries now that we know the owner's id
+ association.send(:construct_sql) if association.respond_to?(:construct_sql)
end_eval
# Doesn't use after_save as that would save associations added in after_create/after_update twice