Method: ArelExtensions::StringFunctions#group_concat
- Defined in:
- lib/arel_extensions/string_functions.rb
#group_concat(sep = nil, *orders, group: nil, order: nil) ⇒ Object
concat elements of a group, separated by sep and ordered by a list of Ascending or Descending
145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/arel_extensions/string_functions.rb', line 145 def group_concat(sep = nil, *orders, group: nil, order: nil) if orders.present? deprecated 'Use the kwarg `order` instead.', what: 'orders' end order_tabs = [orders].flatten.map{ |o| if o.is_a?(Arel::Nodes::Ascending) || o.is_a?(Arel::Nodes::Descending) o elsif o.respond_to?(:asc) o.asc end }.compact ArelExtensions::Nodes::GroupConcat.new(self, sep, group: group, order: (order || order_tabs)) end |