1

我收到以下错误消息:

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
4

1 回答 1

0

就像其他人建议的那样,这可能是权限。我偶尔会在 Vagrant 上遇到类似的问题,并且必须重新启动我的 Vagrant 会话才能让事情恢复正常。

由于您只是在 Windows 中,我会右键单击该文件,确保它不是只读的或设置为任何疯狂的东西,重新启动您的 Web 服务器并再看一下。

于 2012-09-19T19:40:56.970 回答