Permalink
Browse files

Prefer #foreign_key to #primary_key_name when possible for Associatio…

…nMatcher#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: #9
  • Loading branch information...
joelmoss authored and jasonm committed May 19, 2011
1 parent 574461c commit 6b4035c11783a0588e78d3705bb9425b9b5f45b8
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/shoulda/matchers/active_record/association_matcher.rb
@@ -191,7 +191,7 @@ def associated_class
end
def foreign_key
reflection.primary_key_name
reflection.respond_to?(:foreign_key) ? reflection.foreign_key : reflection.primary_key_name
end
def through?

9 comments on commit 6b4035c

@josh-m-sharpe

This comment has been minimized.

Show comment
Hide comment
@josh-m-sharpe

josh-m-sharpe Dec 14, 2011

Any way this can get released?... It's december and I'm still manually changing this line to remove deprecation warnings. :(

josh-m-sharpe replied Dec 14, 2011

Any way this can get released?... It's december and I'm still manually changing this line to remove deprecation warnings. :(

@flackou

This comment has been minimized.

Show comment
Hide comment
@flackou

flackou Jan 10, 2012

+1 for this fix release. Please !

flackou replied Jan 10, 2012

+1 for this fix release. Please !

@chip

This comment has been minimized.

Show comment
Hide comment
@chip

chip replied Jan 12, 2012

+1

@thermistor

This comment has been minimized.

Show comment
Hide comment
@thermistor

thermistor replied Jan 13, 2012

+1 Please

@3den

This comment has been minimized.

Show comment
Hide comment
@3den

3den replied Jan 16, 2012

+1

@gabebw

This comment has been minimized.

Show comment
Hide comment
@gabebw

gabebw Jan 16, 2012

Contributor

Isn't this in 1.0.0?

Contributor

gabebw replied Jan 16, 2012

Isn't this in 1.0.0?

@joshuaclayton

This comment has been minimized.

Show comment
Hide comment
@joshuaclayton

joshuaclayton Jan 16, 2012

Member

@gabebw yes, it is.

Member

joshuaclayton replied Jan 16, 2012

@gabebw yes, it is.

@3den

This comment has been minimized.

Show comment
Hide comment
@3den

3den Jan 16, 2012

@gabebw @joshuaclayton the problem is because shoulda.gemspec still loading old version of shoulda matchers https://github.com/thoughtbot/shoulda/blob/master/shoulda.gemspec

3den replied Jan 16, 2012

@gabebw @joshuaclayton the problem is because shoulda.gemspec still loading old version of shoulda matchers https://github.com/thoughtbot/shoulda/blob/master/shoulda.gemspec

@3den

This comment has been minimized.

Show comment
Hide comment
@3den

3den Jan 16, 2012

I sent a PR to fix this thoughtbot/shoulda#198

3den replied Jan 16, 2012

I sent a PR to fix this thoughtbot/shoulda#198

Please sign in to comment.