aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-11-03 10:23:42 +0000
committerJon Leighton <j@jonathanleighton.com>2011-11-03 10:23:42 +0000
commitb4b178f7e9a00a0235574a773cdbc06fe856acaf (patch)
treed5617680e972962e78dd0a8e3fad19e208451d0f /activerecord/test
parent982a0f37f5239527e9db9225b1dc7e42c6a98417 (diff)
downloadrails-b4b178f7e9a00a0235574a773cdbc06fe856acaf.tar.gz
rails-b4b178f7e9a00a0235574a773cdbc06fe856acaf.tar.bz2
rails-b4b178f7e9a00a0235574a773cdbc06fe856acaf.zip
Fix #3247.
Fixes creating records in a through association with a polymorphic source type.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb5
1 files changed, 5 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 b703c96ec1..2f4dd9e55c 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -825,4 +825,9 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
def test_explicitly_joining_join_table
assert_equal owners(:blackbeard).toys, owners(:blackbeard).toys.with_pet
end
+
+ def test_has_many_through_with_polymorphic_source
+ post = tags(:general).tagged_posts.create! :title => "foo", :body => "bar"
+ assert_equal [tags(:general)], post.reload.tags
+ end
end