62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/ransack/search.rb', line 62
def sorts=(args)
case args
when Array
args.each do |sort|
if sort.kind_of? Hash
sort = Nodes::Sort.new(@context).build(sort)
else
sort = Nodes::Sort.(@context, sort)
end
self.sorts << sort
end
when Hash
args.each do |index, attrs|
sort = Nodes::Sort.new(@context).build(attrs)
self.sorts << sort
end
when String
self.sorts = [args]
else
raise ArgumentError,
"Invalid argument (#{args.class}) supplied to sorts="
end
end
|