Multiple database users for rails app?

Hey guys. Per my IT department’s policies, I need to have two separate
database users for my rails database - one for public intarweb
functionality, one for authenticated users’ functionality. The naive way
to accomodate this would be to break the app up into two separate apps,
but since they share the same models and resources, DRY suggests this
isn’t the proper thing to do.

Ideally, I’d like to have two separate database.yml files, and choose
between them on a controller-by-controller basis. If this is a good
strategy, how might I go about doing it? If not, how would y’all suggest
I structure my app?

  • donald

Ideally, I’d like to have two separate database.yml files, and choose
between them on a controller-by-controller basis. If this is a good
strategy, how might I go about doing it? If not, how would y’all suggest
I structure my app?

  • donald

Why not have a log-in action and if a user is successfully
authenticated, store something in the session. Then you can check for
the existence of this session variable and act accordingly.

Hello Donald,

2007/1/22, Ball, Donald A Jr (Library) [email protected]:

Hey guys. Per my IT department’s policies, I need to have two separate
database users for my rails database - one for public intarweb
functionality, one for authenticated users’ functionality. The naive way
to accomodate this would be to break the app up into two separate apps,
but since they share the same models and resources, DRY suggests this
isn’t the proper thing to do.

I have done something similar previously. I have a site which has a
backend and frontend. The backend has admin functionnality, while the
frontend has different views.

I shared the models using svn:externals, but you could do the same
using a plugin or piston.

Hope that helps !

François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/