7

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

Community
  • 1
  • 1
user626159
  • 165
  • 1
  • 2
  • 6

2 Answers2

3

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

thenengah
  • 42,557
  • 33
  • 113
  • 157
  • 1
    This helped me! I was looking everywhere to figure this out, so funny it was really a simple typo: UserController != UsersController – rtfminc Dec 06 '11 at 06:30
0

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.

Svilen
  • 2,608
  • 24
  • 26
  • I switched to a different dev environment and the problem disappeared so I can't verify that this works, but thanks. Hopefully if someone else comes to this problem via Google, your solution will help them. – user626159 May 05 '11 at 18:22
  • That's ok, works fine... but with that you remove the whole content of your data base... is there another way to solve that problem? – pabloverd May 15 '13 at 18:24
  • 1
    You can dump the contents of the database and import it after db:migrate. Check Heroku's documentation. – Svilen May 15 '13 at 22:56
  • Thanks a lot, here the doc: https://devcenter.heroku.com/articles/heroku-postgres-import-export – pabloverd May 16 '13 at 07:45