diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-05-26 13:08:10 -0700 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-26 13:08:10 -0700 |
commit | 602fff1f58dff5cfdf861b48626b32f99fe27246 (patch) | |
tree | 2fdfc00803474852ab3148d5738d3de2bfa152c7 /activerecord/test/cases/associations | |
parent | 09e431aa893bb1d08705381e2bfcd006de22a70e (diff) | |
parent | f4ed56df43b1f88dca46b1a343ede55e649b327e (diff) | |
download | rails-602fff1f58dff5cfdf861b48626b32f99fe27246.tar.gz rails-602fff1f58dff5cfdf861b48626b32f99fe27246.tar.bz2 rails-602fff1f58dff5cfdf861b48626b32f99fe27246.zip |
Merge pull request #1323 from fx/association_primary_key
use association_primary_key in AssociationScope#add_constraints
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb index f4d14853d3..839a7852fc 100644 --- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb @@ -100,6 +100,16 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase assert_equal 'c1', record[0] assert_equal 't1', record[1] end + + def test_proper_usage_of_primary_keys_and_join_table + setup_data_for_habtm_case + + assert_equal 'country_id', Country.primary_key + assert_equal 'treaty_id', Treaty.primary_key + + country = Country.first + assert_equal 1, country.treaties.count + end def test_has_and_belongs_to_many david = Developer.find(1) |