プレゼンテーション ビルダーを作成していますが、[削除] ボタンをクリックしたときに、リストに表示されている選択したプレゼンテーションを破棄する方法がわかりません。
私のコントローラーは次のようになります。
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 %>
私の目標は、正しい destroy メソッドを記述し、特定のプレゼンテーションに対してこのメソッドを実行するリンク Remove を作成することです。