joncodo
joncodo

Reputation: 2338

Connection Not Established Ruby Postgres

I am getting this error.

ActiveRecord::ConnectionNotEstablished
/Users/jod/.rvm/gems/ruby-1.9.3-p194@BankingApp/gems/activerecord-    4.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
/Users/jod/.rvm/gems/ruby-1.9.3-p194@BankingApp/gems/activerecord-4.0.0.rc1/lib/active_record/connection_handling.rb:79:in `retrieve_connection'
/Users/jod/.rvm/gems/ruby-1.9.3-p194@BankingApp/gems/activerecord-4.0.0.rc1/lib/active_record/connection_handling.rb:53:in `connection'
/Users/jod/.rvm/gems/ruby-1.9.3-p194@BankingApp/gems/activerecord-4.0.0.rc1/lib/active_record/model_schema.rb:208:in `columns'

When trying to run a rake task. In the rake task it takes Class2 and does a create. This will try to create a record in the database.

I could understand this problem but Class1 is saving to the database and is working fine. IE if I save a user, it works as expected and if I save a car, it fails. The classes are identical.

I am using ruby on rails and postgres

Upvotes: 1

Views: 400

Answers (1)

MxLDevs
MxLDevs

Reputation: 19546

When I first got Rails 4 set up, I only needed to set up the gem file to use pg and set up the database.yml file in the config folder to point to the appropriate database and supply it some credentials.

I would assume the task you mentioned in your comments is something that a previous version of Rails did not provide out of the box?

Upvotes: 1

Related Questions