From 3aeb88787c85f48a00f9231b7cccd9e21953fcfb Mon Sep 17 00:00:00 2001 From: Ernie Miller Date: Wed, 5 May 2010 16:52:30 -0400 Subject: [PATCH] Test belongs_to primary key option join --- .../associations/belongs_to_associations_test.rb | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index ab0edee..d9a2eca 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -36,6 +36,11 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert sql !~ /\.id/ assert sql =~ /\.name/ end + + def test_belongs_to_with_primary_key_joining_association_returns_correct_result + client = Client.create(:name => "Awesome, Inc.", :firm_name => companies(:first_firm).name) + assert_equal client, Client.find(:last, :joins => :firm_with_primary_key, :conditions => ["firm_with_primary_keys_companies.name = ?", companies(:first_firm).name]) + end def test_proxy_assignment account = Account.find(1) -- 1.6.4.4