From fe54c6ae71f932a21c9b5c7ffa7af6fad2025fb6 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Mon, 30 Apr 2012 14:23:41 +0800 Subject: [PATCH] Fix bug when id or single object --- app/controllers/orbit_backend_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index 7e9fa32a..15afe963 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -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)