diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index b989b432..aee59c90 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -281,7 +281,7 @@ module TodosHelper end def defer_link(days) - link_to_remote image_tag("defer_#{days}.png"), :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => days, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")} + link_to_remote image_tag("defer_#{days}.png", :alt => "Defer #{pluralize(days, 'day')}"), :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => days, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")} end end diff --git a/db/migrate/042_change_dates_to_datetimes.rb b/db/migrate/042_change_dates_to_datetimes.rb index 99e75179..d534c642 100644 --- a/db/migrate/042_change_dates_to_datetimes.rb +++ b/db/migrate/042_change_dates_to_datetimes.rb @@ -6,14 +6,26 @@ class ChangeDatesToDatetimes < ActiveRecord::Migration change_column :recurring_todos, :end_date, :datetime User.all(:include => [:todos, :recurring_todos]).each do |user| + if !user.prefs ## ugly hack for strange edge-case of not having preferences object + user.instance_eval do + def at_midnight(date) + return Time.zone.local(date.year, date.month, date.day, 0, 0, 0) + end + def time + Time.zone.now + end + end + end user.todos.each do |todo| - todo.update_attribute(:show_from, user.at_midnight(todo.show_from)) unless todo.show_from.nil? - todo.update_attribute(:due, user.at_midnight(todo.due)) unless todo.due.nil? + todo[:show_from] = user.at_midnight(todo.show_from) unless todo.show_from.nil? + todo[:due] = user.at_midnight(todo.due) unless todo.due.nil? + todo.save_with_validation(false) end user.recurring_todos.each do |todo| - todo.update_attribute(:start_from, user.at_midnight(todo.start_from)) unless todo.start_from.nil? - todo.update_attribute(:end_date, user.at_midnight(todo.end_date)) unless todo.end_date.nil? + todo[:start_from] = user.at_midnight(todo.start_from) unless todo.start_from.nil? + todo[:end_date] = user.at_midnight(todo.end_date) unless todo.end_date.nil? + todo.save_with_validation(false) end end end