diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-21 20:47:26 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-21 20:47:26 +0000 |
commit | 989332c734149a7f350a0dd7d483c820552c0267 (patch) | |
tree | caa6fb7ac87cb1ceba2094a76fd5eb6160409a60 /activerecord/test | |
parent | 9e4461438f8ce584b635aca35579c36537a340ca (diff) | |
download | rails-989332c734149a7f350a0dd7d483c820552c0267.tar.gz rails-989332c734149a7f350a0dd7d483c820552c0267.tar.bz2 rails-989332c734149a7f350a0dd7d483c820552c0267.zip |
Save associated records only if the association is already loaded. Closes #8713.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7075 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/associations_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index f009c4348e..52abc20e6e 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -69,7 +69,7 @@ class AssociationsTest < Test::Unit::TestCase end class AssociationProxyTest < Test::Unit::TestCase - fixtures :authors, :posts, :categorizations, :categories + fixtures :authors, :posts, :categorizations, :categories, :developers, :projects, :developers_projects def test_proxy_accessors welcome = posts(:welcome) @@ -98,6 +98,14 @@ class AssociationProxyTest < Test::Unit::TestCase assert david.categories.include?(categories(:technology)) end + def test_save_on_parent_does_not_load_target + david = developers(:david) + + assert !david.projects.loaded? + david.update_attribute(:created_at, Time.now) + assert !david.projects.loaded? + end + end class HasOneAssociationsTest < Test::Unit::TestCase |