Skip to content

Commit

Permalink
Fix keyword arguments handling in names scopes (toptal#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Rabotyaga authored and Çağatay Yücelen committed Jan 28, 2023
1 parent d201acd commit 259a996
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/chewy/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ def build_search_class(base)
def delegate_scoped(source, destination, methods)
methods.each do |method|
destination.class_eval do
define_method method do |*args, **kwargs, &block|
scoping { source.public_send(method, *args, **kwargs, &block) }
define_method method do |*args, &block|
scoping { source.public_send(method, *args, &block) }
end
ruby2_keywords method
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/chewy/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def self.by_name(index)
filter { match name: "Name#{index}" }
end

def self.by_rating_with_kwargs(value, options:)
def self.by_rating_with_kwargs(value, options:) # rubocop:disable Lint/UnusedMethodArgument
filter { match rating: value }
end

Expand Down

0 comments on commit 259a996

Please sign in to comment.