aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-04-25 16:07:31 +0100
committerJon Leighton <j@jonathanleighton.com>2012-04-25 16:07:31 +0100
commit8b941e977c094bb2121f9eaef73f20392d20f581 (patch)
treefb61340ada51952ac9975d6c1a30db783cf5a417 /activerecord/test
parent98de70e2e12cff98acbc38727e709ff99db331b6 (diff)
parent365b8b6db750151b786b0a7ef9e65a6824576f1b (diff)
downloadrails-8b941e977c094bb2121f9eaef73f20392d20f581.tar.gz
rails-8b941e977c094bb2121f9eaef73f20392d20f581.tar.bz2
rails-8b941e977c094bb2121f9eaef73f20392d20f581.zip
Merge remote-tracking branch 'kennyj/fix_5563'
Conflicts: activerecord/test/cases/associations/belongs_to_associations_test.rb
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index 58808871de..05ab86105c 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -717,4 +717,15 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
assert !citibank.association(:firm).stale_target?
end
+
+ def test_reflect_the_most_recent_change
+ author1, author2 = Author.limit(2)
+ post = Post.new(:title => "foo", :body=> "bar")
+
+ post.author = author1
+ post.author_id = author2.id
+
+ assert post.save
+ assert_equal post.author_id, author2.id
+ end
end