【发布时间】:2014-04-16 21:14:37
【问题描述】:
我是 Ruby on Rails 的新手,我知道这有点棘手,但我无法在网上找到解决方案,尽管它应该是最简单的事情......
我已经设置好所有东西,并使用 rails generate controller welcome index 创建了一个新的控制器 + 视图。
文件出现在正确的目录中,我在welcome 文件夹中的/app/views/welcome/ 下有一个index.html.erb 文件。
/config/ 中的路由文件包含到控制器的适当路由
NewApp::Application.routes.draw do
get "welcome/index"
# You can have the root of your site routed with "root"
root 'welcome#index'
end
但即使我已经正确设置了所有内容,但我知道我收到了这个错误:
Missing template welcome/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}.
Searched in: * "/Users/Constantin/Development/Rails [Ruby]/new-app/app/views"
我理解错误信息。它告诉我它在我的应用程序的views 文件夹中以命名格式查找某种模板文件,但我不明白为什么它不起作用。
【问题讨论】:
标签: ruby-on-rails missing-template