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:
- Install Postgresql on your machine
- Create a database for your development needs (let's call it
my_app_development
) 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_developmentrun
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
How to Build Ruby 2.1.3 on Osx 10.10 Gm 3.0 with Rbenv
Can't Run Ruby 2.2.3 with Rvm on Osx
Detecting Regional Settings (List Separator) from Web
Ruby Strftime '%Z' Method Returns '0545' Instead of 'Npt'
How to Install Libksba on MAC Osx
Ruby, How to Access Local Variables Outside the Do - End Loop
Why Are My Rspec Tests Failing, But My App Is Working
Rails: Pundit::Authorizationnotperformederror
Marshal Ruby Hash with Default Proc - Remove the Default Proc
How to Enable Colors with Rspec When Using Jruby or Bundle Exec
How to Define a Simple Global Variable in an Rspec Test That Can Be Accesed by Helper Functions
Convert Ip Address to 32 Bit Integer in Ruby
Fresh Install of Rails and Getting Openssl Errors: "Already Initialized Constant Openssl"
Garbage Collector in Ruby 2.2 Provokes Unexpected Cow
Web Page Scraping Gems/Tools Available in Ruby