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

where mutates original #254

Closed
AlexParamonov opened this issue Apr 26, 2017 · 3 comments
Closed

where mutates original #254

AlexParamonov opened this issue Apr 26, 2017 · 3 comments

Comments

@AlexParamonov
Copy link

AlexParamonov commented Apr 26, 2017

where method should not do any mutation. New object have to be returned back.

so far hotfixed with:

JsonApiClient::Query::Builder.prepend(
  Module.new do
    def where(conditions = {})
      dup.tap do |clone|
        clone.instance_variable_set(:@path_params, @path_params.merge(conditions.slice(*klass.prefix_params)))
        clone.instance_variable_set(:@filters, @filters.merge(conditions.except(*klass.prefix_params)))
      end
    end
  end
)
@gaorlov
Copy link
Collaborator

gaorlov commented Aug 24, 2018

This is a problem for a few things. Do you have a PR for this? If not, I'll start one and would love some feedback on it.

same core issue: #292

@AlexParamonov
Copy link
Author

I've used hotfix mentioned above. Feel free to create a PR

@senid231
Copy link
Member

#293 will solve it

gaorlov added a commit that referenced this issue Aug 27, 2018
@gaorlov gaorlov closed this as completed Aug 27, 2018
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

No branches or pull requests

3 participants