Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has_many and has_one tests fail when the reverse association has a nonstandard name #66

Closed
bloy opened this issue Mar 4, 2012 · 2 comments

Comments

@bloy
Copy link
Contributor

bloy commented Mar 4, 2012

The foreign_key method returns an incorrect column name when a corresponding belongs_to uses a nonstandard foreign key name.

An example:

class User < ActiveRecord::Base
  has_many :posts, :inverse_of => author
end

class Post < ActiveRecord::Base
  belongs_to :author, :inverse_of => :posts, :class_name => :User
end

describe User do
   it { should have_many(:posts) }
end
@gabebw
Copy link

gabebw commented Mar 20, 2012

Can you post the error? Did you come up with a workaround for this?

@bloy
Copy link
Contributor Author

bloy commented Mar 20, 2012

This was an accidental duplicate of #67. Closing

@bloy bloy closed this as completed Mar 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants