Module: Godmin::Resources::ResourceService::Ordering

Extended by:
ActiveSupport::Concern
Included in:
Godmin::Resources::ResourceService
Defined in:
lib/godmin/resources/resource_service/ordering.rb

Instance Method Summary collapse

Instance Method Details

#apply_order(order_param, resources) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/godmin/resources/resource_service/ordering.rb', line 7

def apply_order(order_param, resources)
  if order_param.present?
    resources.order("#{resource_class.table_name}.#{order_column(order_param)} #{order_direction(order_param)}")
  else
    resources
  end
end