0
나는 다음과 같은 오류를 받고 있어요 일치하지 않습니다 :레일 3.2.1 라우팅 오류 없음 경로
attr_accessor :completed
before_filter :find_list
def create
@task = @list.tasks.new(params[:task])
if @task.save
flash[:notice] = "Task created"
redirect_to list_url(@list)
else
flash[:error] = "Could not add task at this time."
redirect_to list_url(@list)
end
end
def complete
@task = @list.tasks.find(params[:id])
@task.completed = true
@task.save
redirect_to list_url(@list)
end
private
def find_list
@list = List.find(params[:list_id])
end
그리고 (오류가 발생)에 show.html.erb :
,<%= button_to "Complete", complete_task_path(@list.id,task.id) %>
누군가 내가 잘못하고있는 것을 말해 줄 수 있습니까? 문제의 원인은 무엇
경로를 올바르게 정의하지 않았습니다. 어쨌든 complete_task_path (task.id, : list_id => @ list.id) 여야한다고 생각합니다. 실제로 레일을 알아낼 정도로 똑똑하기 때문에 .id 부분을 생략 할 수도 있습니다. – vise