Ticket #11514: inspect_on_new_object_association_does_not_reload_association.diff
| File inspect_on_new_object_association_does_not_reload_association.diff, 1.2 kB (added by acirugeda, 4 months ago) |
|---|
-
activerecord/test/cases/associations_test.rb
old new 141 141 assert_equal 1, josh.posts.size 142 142 end 143 143 144 def test_inspect_does_not_lose_additions_to_new_record 145 andres = Author.new(:name => "Andrés") 146 andres.posts.build(:title => "New on Edge", :body => "More cool stuff!") 147 assert !andres.posts.loaded? 148 assert_equal 1, andres.posts.size 149 andres.posts.inspect 150 assert !andres.posts.loaded? 151 assert_equal 1, andres.posts.size 152 end 153 144 154 def test_save_on_parent_does_not_load_target 145 155 david = developers(:david) 146 156 -
activerecord/lib/active_record/associations/association_proxy.rb
old new 73 73 end 74 74 75 75 def inspect 76 reload unless loaded? 76 reload unless loaded? || (@owner.new_record? && !foreign_key_present) 77 77 @target.inspect 78 78 end 79 79