- @tasks.each do |task|
- if task.complete_task == false
div class="panel panel-primary"
div class="panel-heading"
h3 class="panel-title" = link_to task.name, task_path(task)
div class="panel-body"
div class="col-md-11"
= task.description
div class="col-md-1"
div class="bs-glyphicons"
= link_to complete_task_path(task), method: :post do
div class="col-md-6"
span class="glyphicon glyphicon-ok"
= link_to task_path(task), method: :delete do
div class="col-md-6"
span class="glyphicon glyphicon-remove"
private
def task_params
params.require(:task).permit(:name,
:description,
:start_on,
:finish_date,
:repeat,
:complete_task)
Started POST "/tasks/complete_todo/10" for 127.0.0.1 at 2015-01-23 18:43:08 +0300
Processing by TasksController#complete_todo as HTML
Parameters: {"authenticity_token"=>"Y8hE4tSk/qUL1xZDpCgvriUwYhmwfzeH3iwfxa7NB+C6DEKkvJLAQ4V3b6yTw4QUxOMPUTxoGKv36PYxpzmCoQ==", "id"=>"10"}
Task Load (0.3ms) SELECT "tasks".* FROM "tasks" WHERE "tasks"."id" = ? LIMIT 1 [["id", 10]]
Completed 400 Bad Request in 3ms
ActionController::ParameterMissing (param is missing or the value is empty: task):
app/controllers/tasks_controller.rb:56:in `task_params'
app/controllers/tasks_controller.rb:49:in `complete_todo'
...
= link_to finished_task_path(task), method: :post do
div class="col-md-6"
span class="glyphicon glyphicon-ok"
...
Пошел читать доки по Active Record и Action Controller.