Module: Trax::Controller::Collection::Sortable::ClassMethods

Defined in:
lib/trax/controller/collection/sortable.rb

Instance Method Summary collapse

Instance Method Details

#has_sort_scope(sort_scope_name, only: [:index, :search], type: :boolean, **options) ⇒ Object



10
11
12
13
14
15
# File 'lib/trax/controller/collection/sortable.rb', line 10

def has_sort_scope(sort_scope_name, only: [:index, :search], type: :boolean, **options)
  SORT_DIRECTIONS.each do |dir|
    _sort_scope_name = :"#{sort_scope_name}_#{dir}"
    has_scope(_sort_scope_name, only: only, type: type, **options)
  end
end

#has_sort_scopes(*names, **options) ⇒ Object



17
18
19
# File 'lib/trax/controller/collection/sortable.rb', line 17

def has_sort_scopes(*names, **options)
  names.each{ |_name| has_sort_scope(_name, **options) }
end