0

running heroku run rake db:migrate and getting the error:

Running `rake db:migrate` attached to terminal... up, run.9259
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from <top (required)> at /app/config/application.rb:10)
WARNING: Global access to Rake DSL methods is deprecated.  Please include
    ...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Quora::Application#task called at /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:214:in `initialize_tasks'
rake aborted!
Database should be a Mongo::DB, not NilClass.

Locally everything works well. I have a mongoid.yml file that contains configuration for mongo and created a mongo db with mongohq:

defaults: &defaults
  host: '127.0.0.1'
  autocreate_indexes: false
  allow_dynamic_fields: true
  include_root_in_json: false
  parameterize_keys: true
  persist_in_safe_mode: false
  raise_not_found_error: true
  reconnect_time: 3

development:
  <<: *defaults
  database: mydb_development

development_mongohq:
  <<: *defaults
  #use demo mongohq database for fast run
  uri: mongodb://user:pass@linus.mongohq.com:10016/app9861715

test:
  <<: *defaults
  database: quora_test

# set these environment variables on your prod server
production:
  <<: *defaults
  host: '127.0.0.1'
  database: mydb

I have tried searching for a solution or any direction on how to fix with no success. What am i doing wrong?

Edit: i added include Rake::DSL to my Rakefile and now the initial warnings are gone but i still get:

heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.4751
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from <top (required)> at /app/config/application.rb:11)
rake aborted!
Database should be a Mongo::DB, not NilClass.

Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Tom
  • 9,275
  • 25
  • 89
  • 147

1 Answers1

0

I think you're missing :

adapter: mongodb

Here is my setting for postgres database.yml :

development: 
  adapter: postgresql
  encoding: unicode
  database: db
  pool: 50
  username: user
  password: pwd
  host: localhost

You might want to check out this post as well :

https://stackoverflow.com/a/6757749/169277

Community
  • 1
  • 1
ant
  • 22,634
  • 36
  • 132
  • 182