From bfb6c4ee9abcf320178a282ce6862c5249df995f Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Fri, 28 Oct 2011 20:50:38 +0200 Subject: [PATCH] optimize for the common case: selecting only one tag --- app/controllers/todos_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index fdf12454..7f021d80 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -1028,6 +1028,9 @@ class TodosController < ApplicationController end def find_todos_with_tag_expr(tag_expr) + # optimize for the common case: selecting only one tag + return current_user.todos.with_tag(@tag_name) if @single_tag + tag_ids = get_ids_from_tag_expr(tag_expr) todos = current_user.todos tag_ids.each do |ids|