diff --git a/lib/shoulda/matchers/active_record/association_matcher.rb b/lib/shoulda/matchers/active_record/association_matcher.rb index 771bd1dd..251c9049 100644 --- a/lib/shoulda/matchers/active_record/association_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matcher.rb @@ -191,7 +191,7 @@ module Shoulda # :nodoc: end def foreign_key - reflection.primary_key_name + reflection.respond_to?(:foreign_key) ? reflection.foreign_key : reflection.primary_key_name end def through?