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

Delegate primary_key to superclass when necessary, otherwise default #53

Merged
merged 1 commit into from Feb 22, 2013
Merged

Delegate primary_key to superclass when necessary, otherwise default #53

merged 1 commit into from Feb 22, 2013

Conversation

denzel-morris
Copy link
Contributor

Current Behavior

The primary_key attribute does not delegate to the superclass when read; causing the following to happen:

class BaseResource < ActiveResource::Base
  self.primary_key = :custom_key
end

class DerivedResource < BaseResource
end

BaseResource.primary_key    => :custom_key
DerivedResource.primary_key => 'id'

New Behavior

Simply delegate the primary_key attribute to the superclass if it isn't set. Thus becoming:

BaseResource.primary_key    => :custom_key
DerivedResource.primary_key => :custom_key

guilleiguaran added a commit that referenced this pull request Feb 22, 2013
Delegate primary_key to superclass when necessary, otherwise default
@guilleiguaran guilleiguaran merged commit d5be36d into rails:master Feb 22, 2013
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

2 participants