Search code examples
ruby-on-railspostgresqlrails-adminproduction

Rails_admin dont work in production


I got some problems with my rails_admin gem in the production when I trying make first user admin in Rails console. In the development all works fine. Look at the error and code.

Error terminal:

2.3.0 :001 > u = User.first
ActiveRecord::NoDatabaseError: FATAL:  database "myApp_development" does not exist

database.production.yml

default: &default
  adapter: postgresql
  encoding: UTF-8
  pool: 5

development:
  <<: *default
  database: myApp_development
  username: deployer
  password: password

test:
  <<: *default
  database: myApp_test
  username: deployer
  password: password

production:
  <<: *default
  database: myApp_production
  username: deployer
  password: password

Solution

  • To run rails console in the production environment you should use bundle exec rails console production or bundle exec rails console RAILS_ENV=production, the command bundle exec rails console run console in the development env by default.