aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/join_model_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-06-08 00:14:27 +0100
committerJon Leighton <j@jonathanleighton.com>2011-06-08 00:32:49 +0100
commit4f5f6a3257862c0893c89a69321025e5873585dc (patch)
tree66a853f83b96a4e6a51febbcb4562f2101bb1304 /activerecord/test/cases/associations/join_model_test.rb
parenta1e78cfc36960569cf8cd380d9656ac6c14015ae (diff)
downloadrails-4f5f6a3257862c0893c89a69321025e5873585dc.tar.gz
rails-4f5f6a3257862c0893c89a69321025e5873585dc.tar.bz2
rails-4f5f6a3257862c0893c89a69321025e5873585dc.zip
When you add a record to a polymorphic has_one, you should be able to access the owner from the associated record
Diffstat (limited to 'activerecord/test/cases/associations/join_model_test.rb')
-rw-r--r--activerecord/test/cases/associations/join_model_test.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb
index b59ce4efeb..785ea079ed 100644
--- a/activerecord/test/cases/associations/join_model_test.rb
+++ b/activerecord/test/cases/associations/join_model_test.rb
@@ -139,7 +139,10 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase
def test_set_polymorphic_has_one
tagging = tags(:misc).taggings.create
posts(:thinking).tagging = tagging
- assert_equal "Post", tagging.taggable_type
+
+ assert_equal "Post", tagging.taggable_type
+ assert_equal posts(:thinking).id, tagging.taggable_id
+ assert_equal posts(:thinking), tagging.taggable
end
def test_create_polymorphic_has_many_with_scope