Project

General

Profile

« Previous | Next » 

Revision 6c77d09b

Added by Ewoud Kohl van Wijngaarden 3 months ago

Fixes #37273 - Use delegation syntax for resource_scope

In Ruby 3 you need to explicitly delegate keyword arguments, or if you
don't care about Ruby 2.6 or prior then you can use the new delegation
syntax1.

It deals with the difference in calling where. When calling `.where([])`
it returns an array while `.where(*[])` returns an instance of
`WhereChain` which consumers of the method can't deal with. Because of
that it calls `.all`.

[1]: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

View differences:

app/controllers/api/v2/auth_sources_controller.rb
@auth_sources = resource_scope_for_index.except_hidden
end
def resource_scope(*args)
def resource_scope(...)
super.except_hidden
end

Also available in: Unified diff