7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/grape/dsl.rb', line 7
def listing(model:, entity:, scopes: nil, search: nil, sortable: nil, paginate: true, cache: nil, preload: nil)
request_method = request.env['REQUEST_METHOD']
request_uri = request.env['REQUEST_URI']
opts = listing_opts(model, entity, scopes, search, sortable, cache, request_method, request_uri, preload)
if params[:spreadsheet]
listing_spreadsheet(**opts)
elsif paginate
GrapeListingService.paginated(**opts)
else
GrapeListingService.listed(**opts)
end
end
|