aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/join_model_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2012-10-10 19:21:11 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2012-10-10 19:21:11 +0200
commitaffd05d28b3fbd0f6cbbf6e6823e352405f4fd34 (patch)
tree7aa8a2cb20a95aabdad56b9d8aa5845a8056a5b8 /activerecord/test/cases/associations/join_model_test.rb
parent1fc795468525d8622cdca474a54c8310a514aa46 (diff)
parentbadc39fb2fed4d100d2a11fa9a1a2c84c6c33df6 (diff)
downloadrails-affd05d28b3fbd0f6cbbf6e6823e352405f4fd34.tar.gz
rails-affd05d28b3fbd0f6cbbf6e6823e352405f4fd34.tar.bz2
rails-affd05d28b3fbd0f6cbbf6e6823e352405f4fd34.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activerecord/test/cases/associations/join_model_test.rb')
-rw-r--r--activerecord/test/cases/associations/join_model_test.rb8
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