Fix bug for sorting when there's only one category with elements
This commit is contained in:
parent
2bd132cef9
commit
5281464af4
|
@ -103,7 +103,7 @@ class OrbitBackendController< ApplicationController
|
|||
referenced_objects = object_class.find(referer_ids) rescue nil
|
||||
if referenced_objects
|
||||
a = Array.new
|
||||
referenced_objects.each { |referer| a << [get_string_value_from_object(referer), referer.id] }
|
||||
referenced_objects.to_a.each { |referer| a << [get_string_value_from_object(referer), referer.id] }
|
||||
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
|
||||
sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries }
|
||||
sorted_objects.flatten!
|
||||
|
|
Loading…
Reference in New Issue