module Babik::QuerySet::Sortable
Sort functionality of QuerySet
Public Instance Methods
disorder!()
click to toggle source
invert_order!()
click to toggle source
Invert the order e.g.
first_name ASC, last_name ASC, created_at DESC => invert => first_name DESC, last_name DESC, created_at ASC
@return [QuerySet] reference to this QuerySet
.
# File lib/babik/queryset/mixins/sortable.rb, line 36 def invert_order! @_order.invert! self end
order!(*order)
click to toggle source
order_by!(*order)
click to toggle source
Sort QuerySet
according to an order @param order [Array, String, Hash] ordering that will be applied to the QuerySet
.
See {Babik::QuerySet::Order#order_by}.
@return [QuerySet] reference to this QuerySet
.
# File lib/babik/queryset/mixins/sortable.rb, line 12 def order_by!(*order) @_order = Babik::QuerySet::Order.new(@model, *order) self end