views:

37

answers:

2

I am trying to deploy my app on Rails for the first time using Heroku.

I have spent quite a lot of time but there's a gap somewhere.

Git: created private repo, pushed to git successfully
Heroku: created free app and pushed successfully (but app 'crashes')
Local:

rake db:schema:dump #success
rake db:schema:load RAILS_ENV=production #failure: production database is not configured
rake db:create db:load RAILS_ENV=production #failure: undefined method '[]' for nil:NilClass
  active_record/railties/databases.rake:59:in 'rescue in create_database'
  active_record/railties/databases.rake:39:in 'create_database'

My database.yml file:

defaults: &defaults
adapter: mysql
username: root
password: password
host: localhost

development:
<<: *defaults
database: project_dev

test:
<<: *defaults
database: project_test


Just added:
production: <<: *defaults database: project_production

I may be making a total rookie mistake. Do you know where I might be going wrong?

A: 

The rake commands which you are running, run on your development machine. If you want to run rake commands on the server, use the heroku command (example):

heroku rake db:create

Note, if you want to push data, you are doing it wrong. Go to heroku.com and look at the docs there.

Maz
+1  A: 

Use the command heroku rake db:schema:load, which simply executes the command rake db:schema:load on Heroku's environment.

You do not need to worry about the database environments are they are automatically configured by Heroku on the compilation of the slug.

Thomas McDonald