move model validation into pattern classes and link from recurring_todo model

This commit is contained in:
Reinier Balt 2014-02-08 11:51:09 +01:00
parent 776a046465
commit 29b815e998
7 changed files with 201 additions and 77 deletions

View file

@ -7,9 +7,19 @@ module RecurringTodos
end
def every_x_days
@recurring_todo.every_other1
get :every_other1
end
def only_work_days?
get :only_work_days
end
def validate
super
errors[:base] << "Every other nth day may not be empty for this daily recurrence setting" if (!only_work_days?) && every_x_days.blank?
end
end
end