2016-07-29 42 views
0

我在RailsInstaller的Windows 7上使用Rails 5。我正在關注RailsGuides構建博客。爲何RailsInstaller在Windows 7上的Rails 5.0會從gems目錄呈現index.html.erb視圖?

當我將index.html.erb文件更改爲顯示<h1>Hello Rails</h1>時,我得到了相同的(默認的供應商提供的)查看結果。

彪馬服務器給我這個日誌行:

Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0/lib/rails/templates/rails/welcome/index.html.erb 

對於發生了什麼任何幫助嗎?

回答

0

您不能在public之外提供.erb文件。 public目錄用於靜態文件。

如果您想要提供index.html的服務請求public,您的文件必須被稱爲index.html

0

在您的config/routes.rb中,您需要創建默認root。例如:

root to: "welcome#index" 

其中:welcome是控制器和index的名稱是視圖的名稱。

問候

相關問題