No database connection in rails console

That is due to ActiveRecord establishing the connection lazily starting 4.0. Just don’t worry about it.

After it’s established the first time, you’ll start seeing the expected output. Try this:

2.1.4 :001 > User
# => User (call 'User.connection' to establish a connection)

2.1.4 :001 > User.count
# => SELECT COUNT(*) FROM "users" ...

2.1.4 :001 > User
# => User(id: integer, email: string, encrypted_password: string, ...)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)