为什么即使缺少 public 文件夹中的 index.html.erb 文件,也会调用默认页面?

Why default page is calling even though index.html.erb file in public folder is missing?

我正在 rails app.The 上开发一个简单的 ruby 服务器已经启动 successfully.Then 当我们进入默认网络时 url localhost:3000/ 默认路由被调用显示关于 instructions.But 的主页我们不想要这个所以需要删除主项目 public 文件夹中的 index.html.erb 文件 directory.The真正的问题是文件丢失,但默认页面仍在加载。


这里到底发生了什么,index.html.erb 文件在哪里。[不要将其标记为重复,因为这里的问题是不同的]。如何调用另一个路由来显示一些 mypage.html


服务器日志

Started GET "/" for ::1 at 2016-04-19 23:29:26 +0530
Processing by Rails::WelcomeController#index as HTML
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/templates/rails/welcome/index.html.erb (0.0ms)
Completed 200 OK in 36ms (Views: 35.1ms | ActiveRecord: 0.0ms)

public 文件夹中的文件:

400.html
422.html
500.html
favicon.ico
robots.txt

root 添加到您的 routes.rb

root 'MyController#my_action'

您想为您的应用程序设置主目录。只需选择另一条路线,示例如下。

root 'static_pages#home'

找到这个解决方案 Coffee 脚本 1.9.0 不能很好地与 Windows 配合使用。在我的 Windows 7 机器上,使用版本 1.8.0 解决了这个问题。

添加到 Gemfile

gem 'coffee-script-source', '1.8.0'

然后,运行

bundle update coffee-script-source

并重启服务器(如果需要)