Delegate primary_key to superclass when necessary, otherwise default #53

merged 1 commit into from Feb 22, 2013


None yet

2 participants


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

class DerivedResource < BaseResource

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 guilleiguaran merged commit d5be36d into rails:master Feb 22, 2013

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment