toptal / chewy

High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
MIT License
1.89k stars 368 forks source link

Support keyword arguments in named scopes #835

Closed milk1000cc closed 2 years ago

milk1000cc commented 2 years ago

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:

rabotyaga commented 2 years ago

Hey @milk1000cc 👋 ! Thank you very much!

rabotyaga commented 2 years ago

@milk1000cc JFYI: these changes broke ruby 2.6, we had to use another approach to make it compatible - https://github.com/toptal/chewy/pull/836