password: nil might generate errors.
Set a password on the root user:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('rootpw');
and specify in database.yml:
password: rootpw
By default a password is not required for root user.
Establishing a connection in the model class is not required as the connection configured in database.yml is used to connect to the database by default. If a connection with another database or as another user is required use establish_connection. If another database table is required use set_table_name.
|