From 3fbfc13ee35e074b3efd69c8d6dfeafd461dd43c Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sat, 7 Jul 2007 02:42:42 +0000 Subject: Move from select * to select tablename.* to avoid clobbering IDs. Closes #8889 [dasil003] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/finder_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb index c32ceaa466..9c68b604cc 100644 --- a/activerecord/test/finder_test.rb +++ b/activerecord/test/finder_test.rb @@ -507,6 +507,15 @@ class FinderTest < Test::Unit::TestCase assert developer_names.include?('Jamis') end + def test_joins_dont_clobber_id + first = Firm.find( + :first, + :joins => 'INNER JOIN companies AS clients ON clients.firm_id = companies.id', + :conditions => 'companies.id = 1' + ) + assert_equal 1, first.id + end + def test_find_by_id_with_conditions_with_or assert_nothing_raised do Post.find([1,2,3], -- cgit v1.2.3