[英]Rails 3.2.1 template is missing
我收到以下错误消息:
Template is missing
Missing template dishes/show, application/show with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "C:/Sites/restaurant/app/views"
在我的dishes_controller
:
def show
@dish = Dish.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @dish }
end
end
模板不丢失。 它位于app/views/dishes/show.html.erb
C:\\Sites\\restaurant>rake routes
:
root / static_pages#home
dishes GET /dishes(.:format) dishes#index
POST /dishes(.:format) dishes#create
new_dish GET /dishes/new(.:format) dishes#new
edit_dish GET /dishes/:id/edit(.:format) dishes#edit
dish GET /dishes/:id(.:format) dishes#show
PUT /dishes/:id(.:format) dishes#update
DELETE /dishes/:id(.:format) dishes#destroy
help /help(.:format) static_pages#help
about /about(.:format) static_pages#about
contact /contact(.:format) static_pages#contact
menu /menu(.:format) static_pages#menu
就像其他人建议的那样,可能是权限。 我有时会在Vagrant中遇到类似问题,并且必须重新启动Vagrant会话才能使一切恢复正常。
由于您只是在Windows中,因此我将右键单击该文件,确保它不是只读文件或设置为任何疯狂的文件,然后重新启动Web服务器并对其进行重新外观。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.