use new model to handle updating of recurring todos

This commit is contained in:
Reinier Balt 2014-02-03 10:48:21 +01:00
parent 00af159be7
commit c2c67f1640
12 changed files with 166 additions and 104 deletions

View file

@ -3,15 +3,22 @@ module RecurringTodos
class AbstractRepeatPattern
def initialize(user, attributes)
@attributes = attributes
@user = user
@attributes = attributes
@filterred_attributes = nil
end
def build_recurring_todo
@recurring_todo = @user.recurring_todos.build(mapped_attributes)
end
def update_recurring_todo(recurring_todo)
recurring_todo.assign_attributes(mapped_attributes)
recurring_todo
end
def mapped_attributes
# should be overwritten to map attributes to activerecord model
@attributes
end