user626159
user626159

Reputation: 165

Routing works on dev environment, ActionController::RoutingError when pushed to Heroku

I hope someone here can help me with this issue. I am creating a static webpage on my dev environment, so my routing file has one line in it:

TeaserSite::Application.routes.draw do
  root               :to => 'pages#home'
end

On my dev environment, this single page shows up correctly. When I pushed this code to heroku, I get a 404 error at that page. Log output for heroku when I visit the root url:

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 server output on my dev environment:

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)

I checked the following StackOverflow questions for some precedence with this but nothing has helped. I don't have the right-aws gem, changing config.serve_static_assets to true did not help, and I used the "git add ." command before pushing to heroku. Anybody know what the problem could be? For starters, is there any way I can confirm that the PagesController file was actually pushed to Heroku (aside from that calling git push heroku returns "everything up to date")?

Rails - Failing Routes in deployment Rails production static files routing error Heroku: Deploying rails application troubles

Upvotes: 7

Views: 4395

Answers (2)

Sam 山
Sam 山

Reputation: 42865

Do you actually have a controller called PagesController. Did you make sure it is spelled correctly as the filename and in the header.

Upvotes: 3

Svilen
Svilen

Reputation: 2648

I had exactly the same problem - everything was working fine on my development environment, but I got that error on heroku. I made some major changes in my models by deleting and changing most of the migrations files, and I suspect, RubyMine got confused and didn't pushed everything correctly. So I did the following manually in the console:

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

And the problem disappeared.

Upvotes: 0

Related Questions