Ruby on Rails Thursday, March 31, 2011

On 31 Mar 2011, at 02:08, kwb <kylewbock@gmail.com> wrote:

> 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

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment