Ruby-on-rails – Rails console can’t connect to database

macosruby-on-rails

In last days i update my OS X to Maverics. Today when i try to create new project like this:

rails new abc

there were many problems but i install xcode and now it's work. Right now i open rails console like this:

rails console

and then whatever i write i only see:

Loading development environment (Rails 4.0.1)
1.9.3p448 :001 > Link
=> Link(no database connection)

What is wrong? Mysql is running, database exist. When i do rake db:migrate everything works fine.

Best Answer

The console probably does have a database connection but is reporting that it doesn't.

To see if that's true, make a query in the console.

Link.count

That fixed the false positive warning for me and a colleague.