fix #1397 by changing syntax to 1.8.7 compatible

This commit is contained in:
Reinier Balt 2013-02-20 20:05:46 +01:00
parent 3af7d08a4f
commit 7860edd369

View file

@ -235,10 +235,10 @@ class ContextsController < ApplicationController
def render_autocomplete
lambda do
# find contexts and the todos count. use a join to prevent all count(todos) of each context to be fetched
context_and_todo_count = current_user.contexts
.select('contexts.*, count(todos.id) as todos_count')
.joins('left outer join todos on context_id=contexts.id')
.group('context_id')
context_and_todo_count = current_user.contexts.
select('contexts.*, count(todos.id) as todos_count').
joins('left outer join todos on context_id=contexts.id').
group('context_id')
filled_contexts = context_and_todo_count.reject { |ctx| ctx.todos.size == 0 }
empty_contexts = context_and_todo_count.find_all { |ctx| ctx.todos.size == 0 }