0

我已经将我的应用程序部署到Heroku. 结果它给了我 url 并说它已经部署了,当我查看它给我的链接时,我得到了 Welcome to Rails 屏幕。我已经删除了public/index.htm,但我不确定如何设置路线config/routes.rb

顺便说一句,我确定我已经删除了 public/index.htm 但是当我再次访问该 url 时,它显示了 Welcome to Rails。我什至检查了目录,搜索结果index.htm也是 0。会发生什么?

4

2 回答 2

2

如果你已经删除了public/index.html,那么你需要创建一个有效的根路由。替换route to: 'home_controller#index'为以下内容:

# config/routes.rb
root to: 'home#index'

请注意,控制器一词不包含controller#action符号中。因此,home#index 是有效的,但home_controller#index 不是

完成此操作后,将更改提交到版本控制并重新部署到 Heroku。

于 2013-07-15T04:33:01.927 回答
0

从您的git status输出:

# On branch master 
# Changes not staged for commit: 
# (use "git add/rm <file>..." to update what will be     committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
# deleted: public/index.html 
# no changes added to commit (use "git add" and/or "git commit -a")

因此,虽然您确实从工作树中删除了 public/index.html,但您还没有删除 git 中的文件。

为此,如果您git add -A要暂存文件以进行删除,然后git commit -m "Removing file"在重新推送到 Heroku 之前执行 a 以提交更改。

或者,在一行中更短的方法是git commit -am "Removing file"暂存任何已删除的文件,暂存任何更新的文件,然后一次性提交。

于 2013-07-16T07:40:58.583 回答