Skip to content

Commit 9fd1b24

Browse files
committed
fix/Set snippet only for destroy action
1 parent 5b08409 commit 9fd1b24

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/controllers/snippets_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
class SnippetsController < ApplicationController
22
before_action :authenticate_user!, except: :show
3-
before_action :set_snippet, only: %i(edit_modal destroy)
43

54
DELETE_CONFIRM_TEXT = "Are you sure you want to delete this snippet? You won't be able to undo this.".freeze
65
UNFILE_CONFIRM_TEXT = "Are you sure you want to unfile this snippet? It will be removed from your collection.".freeze
@@ -194,6 +193,8 @@ def update
194193
end
195194

196195
def destroy
196+
@snippet = Snippet.find(params[:id])
197+
197198
respond_to do |format|
198199
format.html do
199200
if @snippet.destroy

0 commit comments

Comments
 (0)