我收到以下错误消息:
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
答案 0 :(得分:0)
像其他人建议的那样,它可能是权限。我偶尔会遇到Vagrant这样的问题,并且必须重新启动我的Vagrant会话以使事情恢复正常。
由于您只是在Windows中,我会右键单击该文件,确保它不是只读或设置为任何疯狂,重新启动您的Web服务器并再次查看。