fix #1305 and #1309. Only check on show_from in the past when you change the show_from. This will not prevent a save of the todo when another change is made and show_from has some old date

This commit is contained in:
Reinier Balt 2012-08-26 17:33:51 +02:00
parent be26cfdd66
commit dd83040ea0
3 changed files with 32 additions and 12 deletions

View file

@ -108,8 +108,10 @@ class Todo < ActiveRecord::Base
validate :check_circular_dependencies
def check_show_from_in_future
if !show_from.blank? && show_from < user.date
errors.add("show_from", I18n.t('models.todo.error_date_must_be_future'))
if show_from_changed? # only check on change of show_from
if !show_from.blank? && (show_from < user.date)
errors.add("show_from", I18n.t('models.todo.error_date_must_be_future'))
end
end
end