Fix bug when id or single object

This commit is contained in:
Christophe Vilayphiou 2012-04-30 14:23:41 +08:00
parent bda21baed2
commit fe54c6ae71
1 changed files with 1 additions and 1 deletions

View File

@ -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)