diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-07-07 02:42:42 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-07-07 02:42:42 +0000 |
commit | 3fbfc13ee35e074b3efd69c8d6dfeafd461dd43c (patch) | |
tree | e5026e6053a4faebd98d5dd89f160e4ca4607672 /activerecord/test | |
parent | fd65d89e07d57d809c69043b52a3a1319fb3c2ad (diff) | |
download | rails-3fbfc13ee35e074b3efd69c8d6dfeafd461dd43c.tar.gz rails-3fbfc13ee35e074b3efd69c8d6dfeafd461dd43c.tar.bz2 rails-3fbfc13ee35e074b3efd69c8d6dfeafd461dd43c.zip |
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
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/finder_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
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], |