Home > Blockchain >  ActiveRecord::AdapterNotSpecified: 'development' database is not configured
ActiveRecord::AdapterNotSpecified: 'development' database is not configured

Time:03-03

I'm using MacOS and I'm getting the following error when trying to run rails s or rails routes against a Ruby on Rails repo. I don't know what should be changed.

rails aborted!

ActiveRecord::AdapterNotSpecified: 'development'

database is not configured. Available: ["adapter", "database",

"username", "password", "host", "pool", "timeout", "template"]

/Users/User/myrepo/config/environment.rb:5:in `<top (required)>'

/Users/User/myrepo/bin/rails:9:in `require'

/Users/User/myrepo/bin/rails:9:in `<top (required)>'

/Users/User/myrepo/bin/spring:15:in `<top (required)>' bin/rails:3:in

load' bin/rails:3:in ' Tasks: TOP => routes => environment

This is database.yml

  adapter: postgresql
  database: myrepo_development
  username: app_dbuser
  password: password
  host: 127.0.0.1 #myrepo.something-1.rds.amazonaws.com
  pool: 20
  timeout: 5000
  template: template0

staging:
  adapter: "postgresql"
  database: "myrepo"
  encoding: "utf8"
  host: "myrepo-staging.something-1.rds.amazonaws.com"
  username: "app_dbuser"
  password: "password"
  reconnect: true
  port: 5432

production:
  adapter: "postgresql"
  database: "myrepo"
  encoding: "utf8"
  host: "myrepo.something-1.rds.amazonaws.com"
  username: "app_dbuser"
  password: "password"
  reconnect: true
  port: 5432

test:
  adapter: postgresql
  database: myrepo_test<%= ENV['TEST_ENV_NUMBER'] %>
  username: <%= ENV.fetch("DB_USERNAME") { "app_dbuser" }%>
  password: <%= ENV.fetch("DB_PASSWORD") { "password" }%>
  host: <%= ENV.fetch("DB_HOST") { "127.0.0.1" } %>
  pool: 20
  timeout: 5000
  template: template0

CodePudding user response:

development:
  adapter: postgresql
  database: myrepo_development
  username: app_dbuser
  password: cashbox701
  host: 127.0.0.1 #myrepo.something-1.rds.amazonaws.com
  pool: 20
  timeout: 5000
  template: template0

staging:
  adapter: "postgresql"
  database: "myrepo"
  encoding: "utf8"
  host: "myrepo-staging.something-1.rds.amazonaws.com"
  username: "app_dbuser"
  password: "cashbox701"
  reconnect: true
  port: 5432

production:
  adapter: "postgresql"
  database: "myrepo"
  encoding: "utf8"
  host: "myrepo.something-1.rds.amazonaws.com"
  username: "app_dbuser"
  password: "cashbox701"
  reconnect: true
  port: 5432

test:
  adapter: postgresql
  database: myrepo_test<%= ENV['TEST_ENV_NUMBER'] %>
  username: <%= ENV.fetch("DB_USERNAME") { "app_dbuser" }%>
  password: <%= ENV.fetch("DB_PASSWORD") { "cashbox701" }%>
  host: <%= ENV.fetch("DB_HOST") { "127.0.0.1" } %>
  pool: 20
  timeout: 5000
  template: template0
  • Related