class Cuprum::Rails::Actions::Index
Action
to find and filter resources.
Private Instance Methods
filter_params()
click to toggle source
@note Overload this method to change how the filtering params are defined,
or override the #limit, #offset, #order, #where methods directly.
# File lib/cuprum/rails/actions/index.rb, line 16 def filter_params tools.hash_tools.convert_keys_to_strings(request.params) end
limit()
click to toggle source
# File lib/cuprum/rails/actions/index.rb, line 20 def limit filter_params['limit'] end
offset()
click to toggle source
# File lib/cuprum/rails/actions/index.rb, line 24 def offset filter_params['offset'] end
order()
click to toggle source
# File lib/cuprum/rails/actions/index.rb, line 28 def order filter_params.fetch('order', default_order.presence) end
process(request:)
click to toggle source
Calls superclass method
Cuprum::Rails::Action#process
# File lib/cuprum/rails/actions/index.rb, line 32 def process(request:) super filters = where block = where.present? ? -> { filters } : nil collection.find_matching.call( envelope: true, limit: limit, offset: offset, order: order, &block ) end
tools()
click to toggle source
# File lib/cuprum/rails/actions/index.rb, line 47 def tools SleepingKingStudios::Tools::Toolbelt.instance end
where()
click to toggle source
# File lib/cuprum/rails/actions/index.rb, line 51 def where filter_params['where'] end