From 89c79b8b9537b5ae8a4d3307e719b6ff6acef6f2 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 25 Jun 2007 22:42:19 +0000 Subject: Fix polymorphic has_one associations declared in an abstract class. Closes #8638. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7119 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/associations/join_model_test.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'activerecord/test/associations') diff --git a/activerecord/test/associations/join_model_test.rb b/activerecord/test/associations/join_model_test.rb index 84078e6fff..2e1b4dae88 100644 --- a/activerecord/test/associations/join_model_test.rb +++ b/activerecord/test/associations/join_model_test.rb @@ -2,6 +2,7 @@ require 'abstract_unit' require 'fixtures/tag' require 'fixtures/tagging' require 'fixtures/post' +require 'fixtures/item' require 'fixtures/comment' require 'fixtures/author' require 'fixtures/category' @@ -11,7 +12,7 @@ require 'fixtures/edge' class AssociationsJoinModelTest < Test::Unit::TestCase self.use_transactional_fixtures = false - fixtures :posts, :authors, :categories, :categorizations, :comments, :tags, :taggings, :author_favorites, :vertices + fixtures :posts, :authors, :categories, :categorizations, :comments, :tags, :taggings, :author_favorites, :vertices, :items def test_has_many assert authors(:david).categories.include?(categories(:general)) @@ -229,7 +230,15 @@ class AssociationsJoinModelTest < Test::Unit::TestCase assert_equal tagging, post.tagging end end - + + def test_include_polymorphic_has_one_defined_in_abstract_parent + item = Item.find_by_id(items(:dvd).id, :include => :tagging) + tagging = taggings(:godfather) + assert_no_queries do + assert_equal tagging, item.tagging + end + end + def test_include_polymorphic_has_many_through posts = Post.find(:all, :order => 'posts.id') posts_with_tags = Post.find(:all, :include => :tags, :order => 'posts.id') -- cgit v1.2.3