@ -24,6 +24,11 @@ class MoviesController < ApplicationController
@movie.save
redirect_to @movie
end
def destroy
@movie = Movie.find(params[:id])
@movie.destroy
redirect_to movies_url, status: :see_other
private
@ -15,6 +15,7 @@
</table>
<section class="admin">
<%= link_to "Edit", edit_movie_path(@movie), class: "button" %>
<%= link_to "Delete", movie_path(@movie), class: "button", data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } %>
</section>
</div>