[Rails] When is database.yml loaded with FCGI?
by Just Someone other posts by this author
Dec 4 2005 1:45PM messages near this date
Re: [Rails] unit testing and the schema
|
Re: [Rails] When is database.yml loaded with FCGI?
I'm trying to implement a Postgres based Rails system with multiple
schemas (one per user for security).
For that I need to set a different login user for each of the
connecting users (based on a central authentication system that sets
the login to the session info). SO I need to login as a different user
for each connection coming in.
1) When running a Rails app through FCGI/SCGI, is the database.yml
file loaded only when one of the runners launches, or on every
request?
2) Can I change database.yml so that when it's read with erb it'll
replace the user with something from the session automatically?
In other words, lets say my database.yml looks like:
production:
adapter: postgresql
database: myapp_production
host: localhost
username: <%= session[:db_user] %>
password: <%= session[:db_pass] %>
1) Will this even work?
2) Will it change with each connection?
3) If not, where should I call establish_connection() when a session
starts, so that I can assign the user I want to?
Once I have this figured out I'll write a short wiki page on how to
use postgres schemas to insulate one user from the other, while not
messing with all the rails way of doing things.
Bye,
Guy.
_______________________________________________
Rails mailing list
Rails@[...].org
http://lists.rubyonrails.org/mailman/listinfo/rails
Thread:
Just Someone
Ara T Howard
Just Someone
|