標題說這一切,我不明白爲什麼我得到這個錯誤。沒有路線匹配[刪除](如何建立一個在軌道4 YouTube的教程做的應用程序)
待辦事項控制器:
class TodoListsController < ApplicationController
before_action :set_todo_list, only: [:show, :edit, :update, :destroy]
def index
@todo_lists = TodoList.all
end
def show
end
def new
@todo_list = TodoList.new
end
def edit
end
def create
@todo_list = TodoList.new(todo_list_params)
respond_to do |format|
if @todo_list.save
format.html { redirect_to @todo_list, notice: 'Todo list was successfully created.' }
format.json { render :show, status: :created, location: @todo_list }
else
format.html { render :new }
format.json { render json: @todo_list.errors, status: :unprocessable_entity }
end
end
end
def update
respond_to do |format|
if @todo_list.update(todo_list_params)
format.html { redirect_to @todo_list, notice: 'Todo list was successfully updated.' }
format.json { render :show, status: :ok, location: @todo_list }
else
format.html { render :edit }
format.json { render json: @todo_list.errors, status: :unprocessable_entity }
end
end
end
def destroy
@todo_list.destroy
respond_to do |format|
format.html { redirect_to root_url, notice: 'Todo list was successfully destroyed.' }
format.json { head :no_content }
end
end
private
def set_todo_list
@todo_list = TodoList.find(params[:id])
end
def todo_list_params
params.require(:todo_list).permit(:title, :description)
end
end
你在視圖中傳遞給link_to的是什麼? – madcow