【发布时间】:2014-04-07 21:12:19
【问题描述】:
使用 Devise 3.0 和 Rails 4.0
我似乎无法让我正常的宁静路线工作。
当我访问 URL/products/ 或 URL/products/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
我在 app/views/product
中也有 index.html.erb 和 show.html.erb 视图文件rake 路线输出:
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
有人发现我遗漏了什么明显的东西吗?
【问题讨论】:
标签: ruby-on-rails devise routes