Class: Queryko::Filters::Order
- Inherits:
-
Base
- Object
- Base
- Queryko::Filters::Order
show all
- Defined in:
- lib/queryko/filters/order.rb
Instance Attribute Summary
Attributes inherited from Base
#as, #column_name, #feature, #field, #query_object, #table_name, #table_name_override
Instance Method Summary
collapse
Methods inherited from Base
#call, #initialize
Instance Method Details
9
10
11
12
|
# File 'lib/queryko/filters/order.rb', line 9
def filter_input(token)
return 'DESC' if token.to_s.downcase == 'desc'
return 'ASC'
end
|
14
15
16
|
# File 'lib/queryko/filters/order.rb', line 14
def param_key_format
"order_by_#{column_name}"
end
|
5
6
7
|
# File 'lib/queryko/filters/order.rb', line 5
def perform(collection, token, query_object = nil)
collection.order("#{table_name}.#{column_name} #{filter_input(token)}", )
end
|