Fix bug when id or single object
This commit is contained in:
parent
bda21baed2
commit
fe54c6ae71
|
@ -150,7 +150,7 @@ class OrbitBackendController< ApplicationController
|
|||
|
||||
def get_with_nil(objects, option, sorted_objects)
|
||||
tmp = Array.new
|
||||
objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).count == 0) }
|
||||
objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).blank? || (object.send(option).size == 0 rescue nil)) }
|
||||
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
|
||||
sorted_tmp = sorted.collect {|a| a[1] }
|
||||
a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp)
|
||||
|
|
Loading…
Reference in New Issue