Module: SupplejackApi::Sortable::Query::ClassMethods
- Defined in:
- lib/supplejack_api/admin/sortable.rb
Instance Method Summary collapse
Instance Method Details
#sortable(options = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/supplejack_api/admin/sortable.rb', line 25 def sortable( = {}) = .try(:symbolize_keys) || {} [:page] ||= 1 [:per_page] ||= 25 scope = unscoped scope = scope.sort_order([:order]) if [:order] scope = scope.page([:page]).per([:per_page]) scope end |