Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails error 500, "We're sorry, but something went wrong"

After three evenings on this problem and reading all the posts about this, I have to ask this question finally!

I want to deploy the most simple Rails app to Heroku:

rails new test_appli
cd test_appli
git init
git add .
git  commit -m "initial commit"
heroku create
git push heroku master

Everything's OK, the application works well on Heroku. After that, I'll create a SQLite3 database:

rails generate scaffold User name:string email:string
rake db:migrate

Everything's OK on the local machine. I can see localhost:3000/users well. Then I want to put the DB on Heroku. First I modify my Gemfile:

group :production do
  gem 'pg'
end

group :development, :test do
  gem 'sqlite3'
end

Then I send the whole thing to Heroku:

git init
git add .
git  commit -m "with Database"
git push heroku master
heroku rake db:migrate

Then there are no errors in the batch, everything is OK, the DB is sent, but the page heroku.com/users gives the error

Rails 500, "We're sorry, but something went wrong"

I don't know more what to do. Can you help me?

like image 488
user1036495 Avatar asked Nov 08 '11 22:11

user1036495


2 Answers

I suspect you're trying to deploy a Rails 3.1 application to the bamboo stack (heroku create defaults to the 1.9.2 bamboo stack and doesn't run Rails 3.1 out of the box.). The Cedar stack is much better suited to Rails 3.1 sites -

try

heroku create --stack cedar

when creating your application on Heroku and repush it up. Also note your rake command on Heroku will become

heroku run rake db:migrate
like image 53
John Beynon Avatar answered Oct 19 '22 23:10

John Beynon


Do:

heroku run rake db:schema:load

I had the same issue. It works for me after git push heroku master

like image 21
Eden Cheng Avatar answered Oct 19 '22 23:10

Eden Cheng