Prefer #foreign_key to #primary_key_name when possible for AssociationMatcher#foreign_key
Fixes deprecation warning added in Rails 3.1: https://github.com/rails/rails/blob/v3.1.0.beta1/activerecord/lib/active_record/reflection.rb#L201-208 Closes: https://github.com/thoughtbot/shoulda-matchers/pull/9
This commit is contained in:
parent
574461c63a
commit
6b4035c117
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue