Class: JsonapiCompliable::Scope::Sort

Inherits:
Base
  • Object
show all
Defined in:
lib/jsonapi_compliable/scope/sort.rb

Instance Attribute Summary

Attributes inherited from Base

#controller, #dsl, #params, #scope

Instance Method Summary collapse

Methods inherited from Base

#apply, #apply_standard_or_override, #apply_standard_scope?, #initialize

Constructor Details

This class inherits a constructor from JsonapiCompliable::Scope::Base

Instance Method Details

#apply_custom_scope ⇒ Object



11
12
13
# File 'lib/jsonapi_compliable/scope/sort.rb', line 11

def apply_custom_scope
  custom_scope.call(@scope, attribute, direction)
end

#apply_standard_scope ⇒ Object



7
8
9
# File 'lib/jsonapi_compliable/scope/sort.rb', line 7

def apply_standard_scope
  @scope.order(attribute => direction)
end

#custom_scope ⇒ Object



3
4
5
# File 'lib/jsonapi_compliable/scope/sort.rb', line 3

def custom_scope
  dsl.sorting
end