lib/card/query/sql_statement/order.rb in card-1.103.4 vs lib/card/query/sql_statement/order.rb in card-1.104.0
- old
+ new
@@ -16,16 +16,19 @@
# build ORDER BY clause
module Order
def order
full_syntax do
- "ORDER BY #{order_directives.join ', '}"
+ dirs = order_directives
+ "ORDER BY #{dirs.join ', '}" if dirs.present?
end
end
def order_directives
- Array.wrap(order_config).map do |order_key|
+ return if @mods[:sort].blank?
+
+ Array.wrap(@mods[:sort]).map do |order_key|
order_directive order_key
end
end
def order_directive order_key
@@ -55,13 +58,9 @@
if @mods[:dir].blank?
DEFAULT_ORDER_DIRS[order_key.to_sym] || "asc"
else
safe_sql @mods[:dir]
end
- end
-
- def order_config
- @mods[:sort].blank? ? "update" : @mods[:sort]
end
end
end
end
end