diff --git a/app/models/dependency.rb b/app/models/dependency.rb index dd347c1f..a55308d3 100644 --- a/app/models/dependency.rb +++ b/app/models/dependency.rb @@ -1,7 +1,9 @@ class Dependency < ActiveRecord::Base - belongs_to :predecessor, :foreign_key => 'predecessor_id', :class_name => 'Todo' - belongs_to :successor, :foreign_key => 'successor_id', :class_name => 'Todo' + # touch to make sure todo caches for predecessor and successor are invalidated + + belongs_to :predecessor, :foreign_key => 'predecessor_id', :class_name => 'Todo', :touch => true + belongs_to :successor, :foreign_key => 'successor_id', :class_name => 'Todo', :touch => true end diff --git a/app/views/contexts/_context.html.erb b/app/views/contexts/_context.html.erb index e8221951..f6b940c9 100644 --- a/app/views/contexts/_context.html.erb +++ b/app/views/contexts/_context.html.erb @@ -1,6 +1,8 @@ <% @not_done = @not_done_todos.select {|t| t.context_id == context.id } -cache [context, @source_view] do +# 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")] do %>
">

diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index 1f1b68ca..0f93bd8f 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -1,4 +1,7 @@ -<% cache project do %> +<% +# 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, current_user.date.strftime("%Y%m%d")] do %>

<% if collapsible -%>