Module: SupplejackApi::Sortable::Criteria

Defined in:
lib/supplejack_api/admin/sortable.rb

Instance Method Summary collapse

Instance Method Details

#sort_order(order) ⇒ Object


12
13
14
15
16
17
18
# File 'lib/supplejack_api/admin/sortable.rb', line 12

def sort_order(order)
  if order.to_s =~ /^([\w\_\.]+)_(desc|asc)$/
    order_by("#{Regexp.last_match(1)} #{Regexp.last_match(2)}")
  else
    self
  end
end