development database not configured error in prodection environment

Added by Not Needed almost 6 years ago

I'm trying to create a plugin, following [[http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial]], but I get a strange error. When I execute

$ sudo ruby script/generate redmine_plugin plugin_name RAILS_ENV=production

I get the following error:

NOTE: SourceIndex.new(hash) is deprecated; From /usr/share/redmine/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100:in `new'.
/usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_specification.rb:62:in `establish_connection': development database is not configured (ActiveRecord::AdapterNotSpecified)
        from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
        from /usr/share/redmine/config/../vendor/rails/railties/lib/initializer.rb:438:in `initialize_database'
        from /usr/share/redmine/config/../vendor/rails/railties/lib/initializer.rb:141:in `process'
        from /usr/share/redmine/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
        from /usr/share/redmine/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
        from /usr/share/redmine/config/environment.rb:45
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /usr/share/redmine/vendor/rails/railties/lib/commands/generate.rb:1
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from script/generate:3

Why do I get a "development database is not configured" error when I specifically add RAILS_ENV=production?

Replies (1)

RE: development database not configured error in prodection environment - Added by Not Needed almost 6 years ago

Right, the fix is easy enough, call

$ sudo RAILS_ENV="production" ruby script/generate redmine_plugin plugin_name

instead

(1-1/1)