Skip to content

Instantly share code, notes, and snippets.

@mergulhao
Created September 6, 2011 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mergulhao/1197783 to your computer and use it in GitHub Desktop.
Save mergulhao/1197783 to your computer and use it in GitHub Desktop.
# FIX for this issue
# https://github.com/thoughtbot/shoulda-matchers/commit/6b4035c11783a0588e78d3705bb9425b9b5f45b8
Shoulda::Matchers::ActiveRecord::AssociationMatcher.class_eval do
protected
def foreign_key
reflection.respond_to?(:foreign_key) ? reflection.foreign_key : reflection.primary_key_name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment