diff options
Diffstat (limited to 'app/models/query.rb')
-rw-r--r-- | app/models/query.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index cac43a4e4..b77f76c2e 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -487,7 +487,9 @@ class Query < ActiveRecord::Base if arg.is_a?(Hash) arg = arg.keys.sort.collect {|k| arg[k]} end - c = arg.select {|k,o| !k.to_s.blank?}.slice(0,3).collect {|k,o| [k.to_s, (o == 'desc' || o == false) ? 'desc' : 'asc']} + if arg + c = arg.select {|k,o| !k.to_s.blank?}.slice(0,3).collect {|k,o| [k.to_s, (o == 'desc' || o == false) ? 'desc' : 'asc']} + end write_attribute(:sort_criteria, c) end |