Cassius Rosenthal on 19 Feb 2006 23:50:43 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PhillyOnRails] Initialize ActiveRecord w/o a database.


Here's my scenario: I have an app that interacts with a database in certain ways, but I don't know *which* database it will work with. So the app begins with a user login which corresponds to a database/username/password hash.

Rails normally has this info in 'config/database.yml.' I can't have this, since I don't know what the connection hash is until after the user logs in. I tried leaving 'database.yml' blank and I tried disabling ActiveRecord's initialization. Both cause runtime errors in the app, as it tries to cache relationships I guess.

I also tried running Ruby as a fcgi, and thought of running the app as a non-Rails program. I looked at the Rails fcgi handler as an example. The fcgi handler is so extensive, I gave up on that route for now. [Aside: If someone wants to give a talk on how to use Ruby/fcgi without Rails, I think that would be cool.]

The question: Does anybody have an idea of how to initialize ActiveRecord on-the-fly, without using the config/database.yml' convention?

Thanks!
-Cassius
_______________________________________________
talk mailing list
talk@phillyonrails.org
http://lists.phillyonrails.org/mailman/listinfo/talk