diff --git a/Gemfile.lock b/Gemfile.lock index 40a54be4..b70ba246 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -134,7 +134,7 @@ GEM activesupport (= 4.0.0.rc2) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.0.4) + rake (10.1.0) ref (1.0.5) rspec-expectations (2.13.0) diff-lcs (>= 1.1.3, < 2.0) diff --git a/app/controllers/recurring_todos_controller.rb b/app/controllers/recurring_todos_controller.rb index 66568e54..0dd786f8 100644 --- a/app/controllers/recurring_todos_controller.rb +++ b/app/controllers/recurring_todos_controller.rb @@ -101,7 +101,10 @@ class RecurringTodosController < ApplicationController p.attributes['end_date']=parse_date_per_user_prefs(p.attributes['end_date']) p.attributes['start_from']=parse_date_per_user_prefs(p.attributes['start_from']) - @recurring_todo = current_user.recurring_todos.build(p.selector_attributes) + # make sure we set :recurring_period first, since other setters depend on it being set + # TODO: move logic into model + @recurring_todo = current_user.recurring_todos.build(:recurring_period => params[:recurring_period]) + @recurring_todo.assign_attributes(p.selector_attributes) @recurring_todo.update_attributes(p.attributes) if p.project_specified_by_name? 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)