Changeset 7942
- Timestamp:
- 10/16/07 07:24:23 (1 year ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/associations.rb (modified) (1 diff)
- trunk/activerecord/test/associations_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r7935 r7942 1 1 *SVN* 2 3 * 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. #8713 [Bryan Helmkamp] 2 4 3 5 * Refactor association create and build so before & after callbacks behave consistently. #8854 [lifofifo, mortent] trunk/activerecord/lib/active_record/associations.rb
r7873 r7942 1084 1084 end 1085 1085 1086 if !records_to_save.blank?1087 records_to_save.each { |record| association.send(:insert_record, record) }1088 association.send(:construct_sql)# reconstruct the SQL queries now that we know the owner's id1089 end1086 records_to_save.each { |record| association.send(:insert_record, record) } unless records_to_save.blank? 1087 1088 # reconstruct the SQL queries now that we know the owner's id 1089 association.send(:construct_sql) if association.respond_to?(:construct_sql) 1090 1090 end_eval 1091 1091 trunk/activerecord/test/associations_test.rb
r7935 r7942 15 15 require 'fixtures/tag' 16 16 require 'fixtures/tagging' 17 require 'fixtures/person' 18 require 'fixtures/reader' 17 19 18 20 class AssociationsTest < Test::Unit::TestCase … … 24 26 Class.new(ActiveRecord::Base).has_many(:wheels, :name => 'wheels') 25 27 end 28 end 29 30 def test_should_construct_new_finder_sql_after_create 31 person = Person.new 32 assert_equal [], person.readers.find(:all) 33 person.save! 34 reader = Reader.create! :person => person, :post => Post.new(:title => "foo", :body => "bar") 35 assert_equal [reader], person.readers.find(:all) 26 36 end 27 37