Skip to content

Duplicate arguments in Query::Update to persist primary key #12

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

Merged
merged 2 commits into from
Aug 26, 2014

Conversation

bluetwin
Copy link

Query::Update deletes the primary key for def build_params

def build_params(args)
  @params = {klass.primary_key => args.delete(klass.primary_key), klass.resource_name => args}
end

Instead we can duplicate the args before deleting

def build_params(args)
  args = args.dup
  @params = {klass.primary_key => args.delete(klass.primary_key), klass.resource_name => args}
end

and keep the id when resource.update_attributes completes.

chingor13 added a commit that referenced this pull request Aug 26, 2014
Duplicate arguments in Query::Update to persist primary key
@chingor13 chingor13 merged commit ffcd7d0 into JsonApiClient:master Aug 26, 2014
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.

2 participants