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

Support keyword arguments in named scopes #835

Merged
merged 1 commit into from
Feb 11, 2022
Merged

Support keyword arguments in named scopes #835

merged 1 commit into from
Feb 11, 2022

Conversation

milk1000cc
Copy link
Contributor

@milk1000cc milk1000cc commented Feb 11, 2022

This PR supports keyword arguments in named scopes.

In the current master version, an ArgumentError is raised.
Ruby version is 3.0.2.

class UsersIndex < Chewy::Index
  def self.by_name(name, options:)
  end
end

UsersIndex.limit(10).by_name('Martin', options: 'blah blah blah')
# => wrong number of arguments (given 2, expected 1) (ArgumentError)

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the changelog if the new code introduces user-observable changes. See changelog entry format for details.

@rabotyaga
Copy link
Contributor

Hey @milk1000cc 👋 !
Thank you very much!

@rabotyaga rabotyaga merged commit 876d51c into toptal:master Feb 11, 2022
@rabotyaga
Copy link
Contributor

@milk1000cc JFYI: these changes broke ruby 2.6, we had to use another approach to make it compatible - #836

cyucelen pushed a commit to cyucelen/chewy that referenced this pull request Jan 28, 2023
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.

3 participants