Module: JSONAPI::Support::Sorting
- Included in:
- CollectionQuery
- Defined in:
- lib/json_api/support/concerns/sorting.rb
Instance Method Summary collapse
Instance Method Details
#apply_sorting(scope) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/json_api/support/concerns/sorting.rb', line 6 def apply_sorting(scope) return scope if sort_params.empty? has_virtual_sorts = sort_params.any? { |sort_field| virtual_attribute_sort?(sort_field) } has_virtual_sorts ? apply_virtual_sorting(scope) : apply_db_sorting(scope) end |