Module: AscDesc
- Defined in:
- lib/asc_desc.rb,
lib/asc_desc/railtie.rb,
lib/asc_desc/version.rb,
lib/asc_desc/model_additions.rb
Defined Under Namespace
Modules: ModelAdditions Classes: Railtie
Constant Summary collapse
- ASC =
'ASC'
- DESC =
'DESC'
- VERSION =
'0.0.3'
Class Method Summary collapse
Class Method Details
.format_order_clause(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/asc_desc.rb', line 10 def self.format_order_clause(*args) order = args.last args[0..-2].map do |column| if column.is_a?(Array) format_order_clause(*column << order) elsif column.respond_to?('include?') and column.include?(',') format_order_clause(*column.split(',') << order) else "#{column.to_s.strip} #{order}" end end.join(', ') end |