diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5747573e..4fd7697e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -294,5 +294,9 @@ module ApplicationHelper }) end + def source_view_key + # uses @project.id or @context.id depending on source_view + source_view_is_one_of(:project, :context) ? "#{@source_view}-#{eval("@#{@source_view}.id")}" : @source_view + end end diff --git a/app/views/contexts/_context.html.erb b/app/views/contexts/_context.html.erb index ceb8d908..7bab6ffa 100644 --- a/app/views/contexts/_context.html.erb +++ b/app/views/contexts/_context.html.erb @@ -2,7 +2,7 @@ @not_done = @not_done_todos.select {|t| t.context_id == context.id } # invalidate the cache every day because of staleness or # rendering of "due in x days" that change without touching updated at of the todo -cache [context, @source_view, current_user.date.strftime("%Y%m%d"), @tag_name] do +cache [context, source_view_key, current_user.date.strftime("%Y%m%d"), @tag_name] do -%> <%= render :partial => 'todos/collection', diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index 3a8b2246..70102cec 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -2,7 +2,7 @@ @not_done = @not_done_todos.select {|t| t.project_id == project.id } # invalidate the cache every day because of staleness or # rendering of "due in x days" that change without touching updated at of the todo -cache [project, @source_view, current_user.date.strftime("%Y%m%d"), @tag_name] do +cache [project, source_view_key, current_user.date.strftime("%Y%m%d"), @tag_name] do -%> <%= title = source_view_is(:project) ? t('projects.actions_in_project_title') : show_project_name(project)