diff options
author | Jon Leighton <j@jonathanleighton.com> | 2008-09-07 14:42:33 +0100 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-09-13 11:08:29 +0200 |
commit | fcf31cb7521ba7de0aae972ac2ddfc80e3e7dfce (patch) | |
tree | b01347616c463b6c51f8761e0d9d400c1e775300 /activerecord/test/cases/associations_test.rb | |
parent | 646b5bfa61f8e803d98bd1557c53ea961cc6b16d (diff) | |
download | rails-fcf31cb7521ba7de0aae972ac2ddfc80e3e7dfce.tar.gz rails-fcf31cb7521ba7de0aae972ac2ddfc80e3e7dfce.tar.bz2 rails-fcf31cb7521ba7de0aae972ac2ddfc80e3e7dfce.zip |
Support for updating a belongs to association from the foreign key (without saving and reloading the record)
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#142 state:committed]
Diffstat (limited to 'activerecord/test/cases/associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 056a29438a..2050d16179 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -182,6 +182,18 @@ class AssociationProxyTest < ActiveRecord::TestCase assert_nil p.author.reset end + def test_reset_loads_association_next_time + welcome = posts(:welcome) + david = authors(:david) + author_assoc = welcome.author + + assert_equal david, welcome.author # So we can be sure the test works correctly + author_assoc.reset + assert !author_assoc.loaded? + assert_nil author_assoc.target + assert_equal david, welcome.author + end + def test_reload_returns_assocition david = developers(:david) assert_nothing_raised do |