connecting to other databases not development, production, test

Hello,

I've set my database.yml like this:

development:
  adapter: mysql
  database: teste_development
  username: root
  password:
  socket: /var/run/mysqld/mysqld.sock

test:
  adapter: mysql
  database: teste_test
  username: root
  password:
  socket: /var/run/mysqld/mysqld.sock

production:
  adapter: mysql
  database: teste_production
  username: root
  password:
  socket: /var/run/mysqld/mysqld.sock

other_db:
        adapter: mysql
        database: somedatabase
        username: user
        password: pass
        socket: /var/run/mysqld/mysqld.sock
        host: localhost

In the model I set the connection with: establish_connection
"other_db"

When I run the controller in the browser I get the following error:
other_db database is not configured

Did I miss something? (I restarted the web server)

Thanks.

Hello,

I've set my database.yml like this:

....

production:
adapter: mysql
database: teste_production
username: root
password:
socket: /var/run/mysqld/mysqld.sock

other_db:
       adapter: mysql
       database: somedatabase
       username: user
       password: pass
       socket: /var/run/mysqld/mysqld.sock
       host: localhost

In the model I set the connection with: establish_connection
"other_db"

When I run the controller in the browser I get the following error:
other_db database is not configured

Did I miss something? (I restarted the web server)

Maybe a copy/paste error, but that last entry looks like you are using tabs, not spaces... and YAML files hate tabs...

?

-philip

Exactly, I thought the YAML files were smarter :slight_smile: