我不能讓我的link_to助手,與:方法=>:刪除銷燬對象的link_to有:方法=>:刪除的Rails不工作3
我的應用程序是這樣的
aplication。 html.erb
<!--<!DOCTYPE html>
<html>
<head>
<title>Taskprogect</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
</head>
<body>
<%= yield %>
</body>
</html>-->
<h1>Application layout!</h1>
<%= yield %>
tasks_controller.rb
def destroy
Task.find(params[:id]).destroy
flash[:success] = "Task destroyed."
redirect_to tasks_path
end
index.html.erb
<%= link_to "delete", task, :method => :delete, :confirm => "You sure?",
:title => "Delete #{task.name}" %>
的routes.rb
Taskprogect::Application.routes.draw do
resources :projects
resources :tasks
end
而且的link_to是不行的,在以前的應用程序,工作,也許我已經做了在routes.rb中壞事?
任何想法?謝謝!
而且可以添加一些確認信息,如「你確定嗎?」到button_to幫手?
爲什麼大部分佈局註釋掉了? task是在哪裏定義的(因爲它不是一個實例變量)?點擊鏈接會發生什麼? – polarblau 2012-01-07 20:29:09