我希望有人可以帮我解决这个问题。我在我的开发环境中创建一个静态网页,所以我的路由文件中有一行:
TeaserSite::Application.routes.draw do
root :to => 'pages#home'
end
在我的开发环境中,此单页显示正确。当我将此代码推送到heroku时,我在该页面上收到404错误。当我访问根URL时,记录heroku的输出:
2011-02-20T23:07:36-08:00 app[web.1]: Started GET "/" for 76.28.89.32 at Sun Feb 20 23:07:36 -0800 2011
2011-02-20T23:07:36-08:00 app[web.1]:
2011-02-20T23:07:36-08:00 app[web.1]:
2011-02-20T23:07:36-08:00 app[web.1]: ActionController::RoutingError (uninitialized constant PagesController):
我的开发环境中的Rails服务器输出:
Started GET "/" for 127.0.0.1 at 2011-02-21 02:16:58 -0500
Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (13.3ms)
Completed 200 OK in 85ms (Views: 83.6ms | ActiveRecord: 0.0ms)
我检查了以下StackOverflow问题,但是没有任何帮助。我没有right-aws gem,将config.serve_static_assets更改为true没有帮助,我使用了“git add”。在推送到heroku之前命令。谁知道问题可能是什么?对于初学者,有什么方法可以确认PagesController文件实际上是否被推送到Heroku(除了调用git push heroku返回“一切都是最新的”)?
Rails - Failing Routes in deployment Rails production static files routing error Heroku: Deploying rails application troubles
答案 0 :(得分:3)
你真的有一个名为PagesController
的控制器。你确定它拼写正确的文件名和标题。
答案 1 :(得分:0)
我有完全相同的问题 - 在我的开发环境中一切正常,但我在heroku上遇到了这个错误。我通过删除和更改大多数迁移文件对我的模型进行了一些重大更改,我怀疑,RubyMine感到困惑并没有正确推送所有内容。所以我在控制台中手动执行了以下操作:
git add .
git commit -m "Your comment here"
git push heroku master
heroku rake db:reset # this will force migrate on everything
heroku rake db:migrate # not necessary really, but just to make sure ...
heroku restart # the important bit
问题消失了。