Nomethoderror: Undefined method `Production' for "Development":Activesupport::Stringinquirer

Asked

Viewed 210 times

1

I don’t understand why you’re not migrating.

    deploy@vps8029:/var/www/maisonconvite$ rails db:drop db:create db:migrate db:seed
    rails aborted!
    NoMethodError: undefined method `production' for "development":ActiveSupport::StringInquirer
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/string_inquirer.rb:28:in `method_missing'
    /var/www/maisonconvite/config/initializers/devise.rb:281:in `block in <top (required)>'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/devise-4.4.3/lib/devise.rb:307:in `setup'
    /var/www/maisonconvite/config/initializers/devise.rb:5:in `<top (required)>'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `block in load'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/engine.rb:655:in `block in load_config_initializer'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/notifications.rb:168:in `instrument'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/engine.rb:654:in `load_config_initializer'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/engine.rb:611:in `each'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/engine.rb:611:in `block in <class:Engine>'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `instance_exec'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `run'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/initializable.rb:59:in `block in run_initializers'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/initializable.rb:48:in `each'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/initializable.rb:48:in `tsort_each_child'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/initializable.rb:58:in `run_initializers'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/application.rb:353:in `initialize!'
    /var/www/maisonconvite/config/environment.rb:5:in `<top (required)>'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/application.rb:329:in `require_environment!'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/application.rb:445:in `block in run_tasks_blocks'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/command.rb:46:in `invoke'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>'
    /var/www/maisonconvite/bin/rails:9:in `require'
    /var/www/maisonconvite/bin/rails:9:in `<top (required)>'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
    /home/deploy/.rvm/gems/ruby-2.4.2/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
    /var/www/maisonconvite/bin/spring:15:in `require'
    /var/www/maisonconvite/bin/spring:15:in `<top (required)>'
    bin/rails:3:in `load'
    bin/rails:3:in `<main>'
    Tasks: TOP => db:drop => db:check_protected_environments => environment
    (See full trace by running task with --trace

1 answer

0


You’re running with production environment while it’s supposed to be development.

Seven the RAILS_ENV for development and run the migrations in this way:

RAILS_ENV=development rails db:drop db:create db:migrate && db:seed

A small note: currently in Rails 5 or lower, do not rails db:drop db:create db:migrate db:seed, the db:seed along with the db:migrate makes a type of cache in column information. (See Issue on Github)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.