lib/dhs/concerns/record/chainable.rb in dhs-1.1.0 vs lib/dhs/concerns/record/chainable.rb in dhs-1.2.0

- old
+ new

@@ -220,9 +220,23 @@ else push(Parameter.new(args)) end end + def order(*args) + order_params = {} + args.each do |arg| + if arg.is_a?(Hash) + arg.each do |key, value| + order_params[key] = value + end + else + order_params[arg.to_s] = 'asc' + end + end + push(Parameter.new(order: order_params)) + end + def all(hash = nil) push([Parameter.new(hash), Option.new(all: true)]) end def expanded(options = nil)