aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/finder_test.rb9
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],