Hi I have a nested resource as shown below:
resources :decks do
resources :cards, :except => "index"
end
this is my Decks controller
class DecksController < ApplicationController
def index
@decks = Deck.all
end
def show
@deck = Deck.find(params[:id])
@cards = @deck.cards
end
def new
@deck = Deck.new
end
def create
@deck = Deck.new(params[:deck])
@deck.save
redirect_to decks_path
end
def edit
@deck = Deck.find(params[:id])
end
def update
@deck = Deck.find(params[:id])
@deck.update_attributes(params[:deck])
@deck.save
redirect_to deck_path(@deck)
end
def destroy
@deck = Deck.find(params[:id])
@deck.destroy
redirect_to decks_path
end
end
And this is the Cards controller show method which i want to show the back of the cards.
class CardsController < ApplicationController
def show
deck = Deck.find(params[:id])
@cards = deck.cards
end
end
Im stuck on what i need to to do get them to show.
Thanks