From 4b4dd5408228c342f36bfd8290d39de2cf7bbd71 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 24 Aug 2006 03:36:48 +0000 Subject: Clashing type columns due to a sloppy join shouldn't wreck single-table inheritance. Closes #5838. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4813 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/finder_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb index 626fe137c9..4a79f129c0 100644 --- a/activerecord/test/finder_test.rb +++ b/activerecord/test/finder_test.rb @@ -93,6 +93,11 @@ class FinderTest < Test::Unit::TestCase assert_equal(topics(:second).title, topics.first.title) end + def test_find_by_sql_with_sti_on_joined_table + accounts = Account.find_by_sql("SELECT * FROM accounts INNER JOIN companies ON companies.id = accounts.firm_id") + assert_equal [Account], accounts.collect(&:class).uniq + end + def test_find_first first = Topic.find(:first, :conditions => "title = 'The First Topic'") assert_equal(topics(:first).title, first.title) -- cgit v1.2.3