Rails/Activerecord - Adapternotspecified, Even Though It Is

Rails / ActiveRecord - AdapterNotSpecified, even though it is

You did not define the database for the test environment. Your database.yml file should look like:

development:
adapter: postgresql
host: localhost
username: nekkoru
password: derpderp
database: development
encoding: UTF8

test:
adapter: postgresql
host: localhost
username: nekkoru
password: derpderp
database: test # or whatever the name is
encoding: UTF8

Rails / ActiveRecord - AdapterNotSpecified, even though it is

You did not define the database for the test environment. Your database.yml file should look like:

development:
adapter: postgresql
host: localhost
username: nekkoru
password: derpderp
database: development
encoding: UTF8

test:
adapter: postgresql
host: localhost
username: nekkoru
password: derpderp
database: test # or whatever the name is
encoding: UTF8

ActiveRecord::AdapterNotSpecified - database is not configured

Looks like RAILS_ENV variable is not set. I have not used Bluemix so not sure how to export variables there. If you don't need database, you don't have to include activerecord. see following thread for more details on how to remove activerecord.

ActiveRecord::AdapterNotSpecified database configuration does not specify adapter

For you app to work locally you need to:

  1. Install Postgresql on your machine
  2. Create a database for your development needs (let's call it my_app_development)
  3. Change your database.yml to:

    default: &default
    adapter: postgresql
    encoding: unicode
    # For details on connection pooling, see rails configuration guide
    # http://guides.rubyonrails.org/configuring.html#database-pooling
    pool: 5

    development:
    <<: *default
    database: my_app_development
  4. run rake db:migrate

ActiveRecord::AdapterNotSpecified: 'development' database is not configured

It looks like you are missing the development: line at the top of the file. The yaml looks like it's failing to parse, here's what it should like like.

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 Topics



Leave a reply



Submit