Last active
December 18, 2015 18:39
-
-
Save camkidman/5827248 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DeckController < ApplicationController | |
def index | |
end | |
def new | |
@deck = Deck.new | |
end | |
def create | |
@deck = Deck.new | |
if @deck.save | |
redirect_to user_decks(@user) #added @user 20130619, not sure if it's right | |
else | |
render "new" | |
end | |
end | |
def edit | |
@deck = Deck.find(params[:id]) | |
end | |
def showcards | |
end | |
def addcard | |
@deck = Deck.find(params[:id]) | |
@card = @deck.card # Not sure if this is right | |
end | |
def removecard | |
end | |
def update | |
end | |
def destroy | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
undefined method `decks_index_path' for #<#<Class:0x007f842c3bbde0>:0x007f842cb2f8b0> | |
Extracted source (around line #3): | |
1: # To create a new deck | |
2: | |
3: <%= form_for(@deck) do |f| %> | |
4: <%= f.label :name %> | |
5: <%= f.text_field :name %> | |
6: <%= f.submit %> | |
Rails.root: /home/sp33k3rph433k/pokemonapp | |
Application Trace | Framework Trace | Full Trace | |
app/views/decks/new.html.erb:3:in `_app_views_decks_new_html_erb___3075103149099613798_20941760' | |
new form: | |
<%= form_for(@deck) do |f| %> | |
<%= f.label :name %> | |
<%= f.text_field :name %> | |
<%= f.submit %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To create a new deck | |
<%= form_for(@deck) do |f| %> | |
<%= f.label :name %> | |
<%= f.text_field :name %> | |
<%= f.submit %> | |
<% end %> | |
<%= link_to "Add New Card", new_user_deck_card(@deck) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Since trying to rename my model from "decks" to "deck" | |
Routing Error | |
uninitialized constant User::DecksController | |
Try running rake routes for more information on available routes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pokemonapp::Application.routes.draw do | |
# The priority is based upon order of creation: | |
# first created -> highest priority. | |
namespace :user do | |
resources :decks do | |
member do | |
get 'addcard' | |
get 'showcards' | |
end | |
resources :cards, :controller => 'deck/cards' | |
end | |
end | |
# resources :users do | |
# resources :decks, :controler => 'users/decks' | |
# end | |
# resources :decks do | |
# resources :cards, :controller => 'decks/cards' | |
# end | |
resources :users | |
match "user" => 'user#index' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment