summaryrefslogtreecommitdiff
path: root/app/controllers/tasks_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/tasks_controller.rb')
-rw-r--r--app/controllers/tasks_controller.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb
index f072770..8510c0e 100644
--- a/app/controllers/tasks_controller.rb
+++ b/app/controllers/tasks_controller.rb
@@ -6,14 +6,17 @@ class TasksController < ApplicationController
end
def create
- @task_list.tasks.create!(task_params)
+ @task = @task_list.tasks.create!(task_params)
+ if task_params[:recurs_at]
+ TaskReminderJob.set(wait: task_params[:recurs_at]).perform_later(@task.id, task_params[:recurs_at])
+ end
redirect_to @task_list
end
private
def task_params
- params.require(:task).permit(:name)
+ params.require(:task).permit(:name, :recurs_at)
end
def set_task_list