Question about setting database config without database.yml

A little background.

We are deploying a rails app on jboss by using warbler and the app is
using rails 3.0.3.

There are several parameters the customer may need to change. Some of
these parameters include database connection information, ie shema,
username, password, host, port, and database. We are connecting
through oracle thorugh the jdbc adapter.

My problem lies in the fact that I cannot insert ruby/jruby code into
the database.yml file so I need to be able to specify connection
information somewhere in the ruby code.

In application.rb i have tried the following after printing the public
methods on config

config.database_configuration = {
:adapter => ‘jdbc’,
:driver => ‘oracle.jdbc.driver.OracleDriver’,
:url => ‘jdbc:oracle:think@host:1521:dbname’,
:username => ‘username’,
:password => ‘password’
}

I’m not sure if this is the right way (or place) to do this but any
help you can give me would be greatly appreciated

On 31 Mar 2011, at 02:08, kwb [email protected] wrote:

My problem lies in the fact that I cannot insert ruby/jruby code into
:username => ‘username’,
:password => ‘password’
}

I’m not sure if this is the right way (or place) to do this but any
help you can give me would be greatly appreciated

You can put ERb into your database.yml, and Rails will evaluate it
before loading the YAML.

Not sure if this is the best solution for you, though. I think that
depends on exactly how you intend your customer to edit these settings.
But it’s an option.

Chris