mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-07 00:11:47 +01:00
use new model to handle updating of recurring todos
This commit is contained in:
parent
00af159be7
commit
c2c67f1640
12 changed files with 166 additions and 104 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue