In the destroy method of our DecksController we use an instance variable to retrieve the deck we have to delete and then destroy it:
def destroy @deck = Deck.find(params[:id]) @deck.destroy redirect_to "/decks" end
I understand the need to assign the deck to an instance variable in, say, our show method, because our show view will use that variable, but i don’t really see the need for doing that when no view will use it.
Is there a particular reason to using an instance variable in destroy even if no view will use that variable? Or is it just considered best practice?