Ticket #8713: prevent_associations_from_autoloading_on_save.patch
| File prevent_associations_from_autoloading_on_save.patch, 1.5 kB (added by blaine, 1 year ago) |
|---|
-
activerecord/test/associations_test.rb
old new 69 69 end 70 70 71 71 class AssociationProxyTest < Test::Unit::TestCase 72 fixtures :authors, :posts, :categorizations, :categories 72 fixtures :authors, :posts, :categorizations, :categories, :developers, :projects, :developers_projects 73 73 74 74 def test_proxy_accessors 75 75 welcome = posts(:welcome) … … 98 98 assert david.categories.include?(categories(:technology)) 99 99 end 100 100 101 def test_save_on_parent_does_not_load_target 102 david = developers(:david) 103 104 assert !david.projects.loaded? 105 david.update_attribute(:created_at, Time.now) 106 assert !david.projects.loaded? 107 end 108 101 109 end 102 110 103 111 class HasOneAssociationsTest < Test::Unit::TestCase -
activerecord/lib/active_record/associations.rb
old new 1101 1101 after_callback = <<-end_eval 1102 1102 association = instance_variable_get("@#{association_name}") 1103 1103 1104 if association.respond_to?(:loaded?) 1104 if association.respond_to?(:loaded?) && association.loaded? 1105 1105 if @new_record_before_save 1106 1106 records_to_save = association 1107 1107 else