2013-11-22 150 views
1

這裏有新的rails用戶。我試圖讓用戶在位於/遊戲的表單上輸入金額,保存金額,然後轉發到/遊戲,但我的路線有問題。路徑導軌錯誤4

導航到/遊戲導致錯誤「沒有路由匹配[GET] 」/遊戲「

我已經在控制檯上運行此:

軌生成器遊戲指數

這裏是我的路由文件:

App::Application.routes.draw do 

    get "game/index" 
    resources :users 
    resources :invoices 
    resources :payments 
    resources :rolls 
    resources :bets 
    resources :gamerounds 
    resources :games 

    root "games#index" 
end 

這裏的錯誤消息的其餘部分,列出可用路由:

game_index_path GET  /game/index(.:format) game#index 
welcome_index_path GET  /welcome/index(.:format) welcome#index 
users_path GET  /users(.:format) users#index 
POST  /users(.:format) users#create 
new_user_path GET  /users/new(.:format) users#new 
edit_user_path GET  /users/:id/edit(.:format) users#edit 
user_path GET  /users/:id(.:format) users#show 
PATCH /users/:id(.:format) users#update 
PUT /users/:id(.:format) users#update 
DELETE /users/:id(.:format) users#destroy 
invoices_path GET  /invoices(.:format)  invoices#index 
POST  /invoices(.:format)  invoices#create 
new_invoice_path  GET  /invoices/new(.:format)  invoices#new 
edit_invoice_path GET  /invoices/:id/edit(.:format) invoices#edit 
invoice_path  GET  /invoices/:id(.:format)  invoices#show 
PATCH /invoices/:id(.:format)  invoices#update 
PUT /invoices/:id(.:format)  invoices#update 
DELETE /invoices/:id(.:format)  invoices#destroy 
payments_path GET  /payments(.:format)  payments#index 
POST  /payments(.:format)  payments#create 
new_payment_path  GET  /payments/new(.:format)  payments#new 
edit_payment_path GET  /payments/:id/edit(.:format) payments#edit 
payment_path  GET  /payments/:id(.:format)  payments#show 
PATCH /payments/:id(.:format)  payments#update 
PUT /payments/:id(.:format)  payments#update 
DELETE /payments/:id(.:format)  payments#destroy 
rolls_path GET  /rolls(.:format) rolls#index 
POST  /rolls(.:format) rolls#create 
new_roll_path GET  /rolls/new(.:format) rolls#new 
edit_roll_path GET  /rolls/:id/edit(.:format) rolls#edit 
roll_path GET  /rolls/:id(.:format) rolls#show 
PATCH /rolls/:id(.:format) rolls#update 
PUT /rolls/:id(.:format) rolls#update 
DELETE /rolls/:id(.:format) rolls#destroy 
bets_path GET  /bets(.:format)  bets#index 
POST  /bets(.:format)  bets#create 
new_bet_path  GET  /bets/new(.:format)  bets#new 
edit_bet_path GET  /bets/:id/edit(.:format) bets#edit 
bet_path  GET  /bets/:id(.:format)  bets#show 
PATCH /bets/:id(.:format)  bets#update 
PUT /bets/:id(.:format)  bets#update 
DELETE /bets/:id(.:format)  bets#destroy 
gamerounds_path GET  /gamerounds(.:format) gamerounds#index 
POST  /gamerounds(.:format) gamerounds#create 
new_gameround_path GET  /gamerounds/new(.:format) gamerounds#new 
edit_gameround_path GET  /gamerounds/:id/edit(.:format) gamerounds#edit 
gameround_path GET  /gamerounds/:id(.:format) gamerounds#show 
PATCH /gamerounds/:id(.:format) gamerounds#update 
PUT /gamerounds/:id(.:format) gamerounds#update 
DELETE /gamerounds/:id(.:format) gamerounds#destroy 
games_path GET  /games(.:format) games#index 
POST  /games(.:format) games#create 
new_game_path GET  /games/new(.:format) games#new 
edit_game_path GET  /games/:id/edit(.:format) games#edit 
game_path GET  /games/:id(.:format) games#show 
PATCH /games/:id(.:format) games#update 
PUT /games/:id(.:format) games#update 
DELETE /games/:id(.:format) games#destroy 
root_path GET / games#index 

有什麼建議?提前致謝!

+0

爲什麼你使用兩個不同的名稱爲相同的資源'遊戲'? –

回答

1

您明確創建了一條名爲game/index的路線,因此如果您轉到​​,它將起作用。

調整你的路線get "game/index"get "game" - 這應該解決這個直接的問題。