Complete Lesson 15
This commit is contained in:
parent
bc7bcca0c3
commit
8019ae0bfd
@ -24,6 +24,11 @@ class MoviesController < ApplicationController
|
|||||||
@movie.save
|
@movie.save
|
||||||
redirect_to @movie
|
redirect_to @movie
|
||||||
end
|
end
|
||||||
|
def destroy
|
||||||
|
@movie = Movie.find(params[:id])
|
||||||
|
@movie.destroy
|
||||||
|
redirect_to movies_url, status: :see_other
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
</table>
|
</table>
|
||||||
<section class="admin">
|
<section class="admin">
|
||||||
<%= link_to "Edit", edit_movie_path(@movie), class: "button" %>
|
<%= 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>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user