答案 0 :(得分:0)
我发现解决方案这些是正在使用的范围。我的解决方案是
scope("New Jobs") do |jobs|
jobs.where('"isCompleted" = ? OR "isCompleted" is NULL', false).order('created_at desc')
end
scope("Completed Jobs") { |scope| scope.where(isCompleted: true).order('updated_at desc') }
scope("Closed Jobs") { |scope| scope.where(is_closed: true).order('updated_at desc') }
scope("Exported Jobs") { |scope| scope.where(is_exported: true).order('updated_at desc') }
scope("Unassigned Jobs") { |scope| scope.where(subcontractor_id: nil).order('updated_at desc') }
scope ("On Hold Jobs") { |scope| scope.where(is_closed: true).where(task_user_status_SHLD: true)}