Changeset 7076
- Timestamp:
- 06/21/07 20:50:53 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1-2-stable/activerecord/CHANGELOG
r7012 r7076 1 1 *SVN* 2 3 * Save associated records only if the association is already loaded. #8713 [blaine] 2 4 3 5 * Changing the :default Date format doesn't break date quoting. #6312 [bshand, Elias] branches/1-2-stable/activerecord/lib/active_record/associations.rb
r6805 r7076 994 994 after_callback = <<-end_eval 995 995 association = instance_variable_get("@#{association_name}") 996 997 if association.respond_to?(:loaded?) 996 997 if association.respond_to?(:loaded?) && association.loaded? 998 998 if @new_record_before_save 999 999 records_to_save = association … … 1005 1005 end 1006 1006 end_eval 1007 1007 1008 1008 # Doesn't use after_save as that would save associations added in after_create/after_update twice 1009 1009 after_create(after_callback) branches/1-2-stable/activerecord/test/associations_test.rb
r6805 r7076 68 68 69 69 class AssociationProxyTest < Test::Unit::TestCase 70 fixtures :authors, :posts 71 70 fixtures :authors, :posts, :developers, :projects, :developers_projects 71 72 72 def test_proxy_accessors 73 73 welcome = posts(:welcome) … … 87 87 david.posts_with_extension.first # force load target 88 88 assert_equal david.posts_with_extension, david.posts_with_extension.testing_proxy_target 89 end 90 91 def test_save_on_parent_does_not_load_target 92 david = developers(:david) 93 94 assert !david.projects.loaded? 95 david.update_attribute(:created_at, Time.now) 96 assert !david.projects.loaded? 89 97 end 90 98 end