thoughtbot/shoulda — Issue #196: Validations matchers are failing in Rails 3.1.2beta
Author: stanislaw
Created: 2011-12-18 19:05:52+00:00
State: open

Hello!

After upgrading Rails to 3.1.2beta, validations matchers (#belong_to, #have_many) began failing. On Rails 3.1.3 all works OK!

Thanks!

```ruby
Failure/Error: it { should have_many(:comments) }
NoMethodError:
undefined method `primary_key_name' for
#
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/shoulda-2.11.3/lib/shoulda/active_record/matchers/association_matcher.rb:194:in
`foreign_key'
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/shoulda-2.11.3/lib/shoulda/active_record/matchers/association_matcher.rb:173:in
`class_has_foreign_key?'
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/shoulda-2.11.3/lib/shoulda/active_record/matchers/association_matcher.rb:127:in
`has_foreign_key_missing?'
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/shoulda-2.11.3/lib/shoulda/active_record/matchers/association_matcher.rb:117:in
`foreign_key_exists?'
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/shoulda-2.11.3/lib/shoulda/active_record/matchers/association_matcher.rb:75:in
`matches?'
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/rspec-expectations-2.7.0/lib/rspec/expectations/handler.rb:11:in
`handle_matcher'
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/rspec-expectations-2.7.0/lib/rspec/expectations/extensions/kernel.rb:12:in
`should'
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/rspec-core-2.7.1/lib/rspec/core/subject.rb:54:in
`should'
# ./spec/models/todo_spec.rb:11:in `block (2 levels) in '
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:51:in
`instance_eval'
# /home/stanislaw/.rvm/gems/ruby-1.9.2-head/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:51:in
`block in run'

```