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

Eager loading has_many association when primary_key is a method #1696

Closed
wants to merge 2 commits into from

Conversation

sigmike
Copy link

@sigmike sigmike commented Jun 14, 2011

In a has_many association, the primary key may be a method (the doc says: "Specify the method that returns the primary key used for the association. By default this is id."). It works fine except when the association is eager loaded. In this case it uses the nonexistent attribute and loads an empty list of records.

This fix is based on 3-0-stable.

jake3030 pushed a commit to jake3030/rails that referenced this pull request Jun 28, 2011
…d associations are empty [rails#1696 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
@spastorino
Copy link
Contributor

is this an issue in 3-1-stable?

@isaacsanders
Copy link
Contributor

@piglop Is this still an issue?

@rafaelfranca
Copy link
Member

This pull request is for a not supported Rails version. I'm closing it now. Please see if this one is still can be applied in the Rails >= 3.1. If so, please open another one against the master branch.

Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants