diff options
author | Jason Cheow <jason@jasoncheow.com> | 2010-11-14 13:55:36 +0800 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-11-14 15:32:52 -0200 |
commit | 93c9f4a942c622ecbe8d46ab4838bd072aef9fc0 (patch) | |
tree | 177c6752e9a15b22ccd53b893e65ef002a54c20f /activerecord/test | |
parent | fae4264a7efe2df4890b5f1095bd7454e3bcb939 (diff) | |
download | rails-93c9f4a942c622ecbe8d46ab4838bd072aef9fc0.tar.gz rails-93c9f4a942c622ecbe8d46ab4838bd072aef9fc0.tar.bz2 rails-93c9f4a942c622ecbe8d46ab4838bd072aef9fc0.zip |
Fix bug where size of through association is not correct after adding a has_many association (occurs only before main object has been reloaded).
[#5968 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 4b9f49f1ec..94e1eb8c89 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -449,4 +449,11 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase comment = post.comments.build assert author.comments.include?(comment) end + + def test_size_of_through_association_should_increase_correctly_when_has_many_association_is_added + post = posts(:thinking) + readers = post.readers.size + post.people << people(:michael) + assert_equal readers + 1, post.readers.size + end end |