Module: FetcheableOnApi::Sortable::ClassMethods
- Defined in:
- lib/fetcheable_on_api/sortable.rb
Overview
Class methods made available to your controllers.
Instance Method Summary collapse
-
#sort_by(*attrs) ⇒ Object
Define one ore more sortable attribute configurations.
Instance Method Details
#sort_by(*attrs) ⇒ Object
Define one ore more sortable attribute configurations.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fetcheable_on_api/sortable.rb', line 34 def sort_by(*attrs) = attrs. .symbolize_keys! self.sorts_configuration = sorts_configuration.dup attrs.each do |attr| sorts_configuration[attr] ||= { as: attr, } sorts_configuration[attr] = sorts_configuration[attr].merge() end end |