2014-04-07 79 views
0

使用設計3.0和Rails 4.0軌REST風格的路由與設計不工作

我似乎無法讓我的正常寧靜路線工作。

當我訪問網址/產品/網址/產品/ 3460(查看特定產品的「作秀」行爲),我給下面的錯誤分別是:

Missing Template 

Missing template products/show, application/show with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. 

Products_controller.rb

class ProductsController < ApplicationController 

def index 
    @products = Product.all 
end 

def show 
@product = Product.find(params[:id]) 

respond_to do |format| 
    format.html # show.html.erb 
    format.json { render json: @product } 
end 

end 

我也有應用程序/意見index.html.erb和show.html.erb意見文件/產品

耙路線輸出:

 Prefix Verb URI Pattern     Controller#Action 
    new_user_session GET /users/sign_in(.:format)  devise/sessions#new 
     user_session POST /users/sign_in(.:format)  devise/sessions#create 
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy 
      products GET /products(.:format)   products#index 
        POST /products(.:format)   products#create 
     new_product GET /products/new(.:format)  products#new 
     edit_product GET /products/:id/edit(.:format) products#edit 
      product GET /products/:id(.:format)  products#show 
        PATCH /products/:id(.:format)  products#update 
        PUT /products/:id(.:format)  products#update 
        DELETE /products/:id(.:format)  products#destroy 
       root GET /       application#index 
        GET /products(.:format)   products#index 
       login GET /login(.:format)    devise/sessions#new 
       logout DELETE /logout(.:format)   devise/sessions#destroy 

任何人都看不到明顯的我失蹤?

回答

3

show.html.erb視圖文件必須存在於app/views/products目錄中。

products(複數)和不product(單數)。

+0

grr這樣一個愚蠢的錯誤。非常感謝。這解決了它。 – Devin

+0

很高興幫助:) –