mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 01:08:50 +01:00
fix #1397 by changing syntax to 1.8.7 compatible
This commit is contained in:
parent
3af7d08a4f
commit
7860edd369
1 changed files with 4 additions and 4 deletions
|
|
@ -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 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue