Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use association_primary_key in AssociationScope#add_constraints
  • Loading branch information
fx committed May 26, 2011
1 parent badc72f commit 1f7c3d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -60,7 +60,7 @@ def add_constraints(scope)

scope = scope.joins(join(
join_table,
table[reflection.active_record_primary_key].
table[reflection.association_primary_key].
eq(join_table[reflection.association_foreign_key])
))

Expand Down
Expand Up @@ -100,6 +100,13 @@ def test_should_property_quote_string_primary_keys
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

country = Country.first
assert_equal 1, country.treaties.count
end

def test_has_and_belongs_to_many
david = Developer.find(1)
Expand Down

0 comments on commit 1f7c3d0

Please sign in to comment.