ankane/multiverse

Initial generate task fails

navjeetc opened this issue · 2 comments

I am using ruby 2.2.9 and Rails 4.2.11 and after generating a new Rails project and running the command to generate the multiverse db I get this error:

codespace:~/workspace/store$ bundle exec rails generate multiverse:db catalog
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:

  • development - set it to false
  • test - set it to false (unless you use a tool that preloads your test environment)
  • production - set it to true

/usr/local/rvm/gems/ruby-2.2.9/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/connection_specification.rb:248:in `resolve_symbol_connection': '' database is not configured. Available: ["default", "development", "test", "production"] (ActiveRecord::AdapterNotSpecified)
        from /usr/local/rvm/gems/ruby-2.2.9/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/connection_specification.rb:211:in `resolve_connection'
        from /usr/local/rvm/gems/ruby-2.2.9/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/connection_specification.rb:139:in `resolve'

The database.yml is default generated by Rails for sqlite3.

BTW I am using codespaces (new feature to edit/run code in Github repo)
Did I miss any step?

Hey @navjeetc, from what I can tell, it looks like the Rails environment is set to an empty string. A few things to try:

  • What does Rails.env return in the Rails console?
  • Does bundle exec rake db:migrate run successfully?
  • Does RAILS_ENV=production RACK_ENV=production bundle exec rails generate multiverse:db catalog work?
  • Does RAILS_ENV=development RACK_ENV=development bundle exec rails generate multiverse:db catalog work?

Edit: fwiw, I was able to reproduce that error message with RAILS_ENV="" bundle exec ....

@ankane you are right. RAILS_ENV was the problem. It is working now. Thanks.