0
我正在構建演示文稿構建器,並且我不知道如何銷燬列表中顯示的選定演示文稿,當我單擊Remove按鈕時。書寫方法銷燬並創建鏈接銷燬對象
我的控制器看起來像這樣:
def create
if logged_in?
presentation = current_user.presentations.create data: params.to_yaml
redirect_to edit_presentation_path(presentation)
end
end
def edit
render action: :new
end
# def destroy
# current_presentation.destroy
# end
def show
render action: :new
end
def list
@presentations = current_user.presentations
end
def update
current_presentation.update_attributes(data: params.to_yaml)
end
def home
if logged_in?
@presentations = current_user.presentations
end
end
我創建的演示文稿的列表看起來像這樣:
<% @presentations.each do |p| %>
<a > <%= p.id %>
<a href="<%= presentation_path(p) %>" target="_blank" class="action"> Show </a>
<a class="action"> Remove </a>
</a>
<% end %>
我的目標是:編寫正確的破壞方法和創建執行這樣的鏈接刪除方法進行特定演示。
嗯,這似乎是工作,但我應該怎麼做有:模板丟失的錯誤 – lipenco
刪除演示只是重新回到你的索引頁或任何網頁你想後 – LHH