diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-09 20:14:33 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-09 20:14:33 -0700 |
commit | 269adaec211c41301271f02a597d1ed170deb717 (patch) | |
tree | 6efcb3f6479cd07b8416332c11e6aef790923f14 /activerecord/test | |
parent | 1c534c6e429b6d5115153a8e83ae13e55d0ee1d3 (diff) | |
parent | 9f3b8cd5a5e37583bf9356456a3fc1b3484f4294 (diff) | |
download | rails-269adaec211c41301271f02a597d1ed170deb717.tar.gz rails-269adaec211c41301271f02a597d1ed170deb717.tar.bz2 rails-269adaec211c41301271f02a597d1ed170deb717.zip |
Merge pull request #7859 from ernie/fix-collection-associations-with-select
Fix has_many assocation w/select load after create
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/join_model_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index 86893ec4b3..9b00c21b52 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -231,6 +231,14 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase assert_equal "2", categories(:sti_test).authors_with_select.first.post_id.to_s end + def test_create_through_has_many_with_piggyback + category = categories(:sti_test) + ernie = category.authors_with_select.create(:name => 'Ernie') + assert_nothing_raised do + assert_equal ernie, category.authors_with_select.detect {|a| a.name == 'Ernie'} + end + end + def test_include_has_many_through posts = Post.all.merge!(:order => 'posts.id').to_a posts_with_authors = Post.all.merge!(:includes => :authors, :order => 'posts.id').to_a |