Forum: Ruby on Rails multiple database users for rails app?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ball, Donald A Jr (Library) (Guest)
on 2007-01-23 00:16
(Received via mailing list)
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
Drew O. (Guest)
on 2007-01-23 00:19
> 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.
François B. (Guest)
on 2007-01-23 00:21
(Received via mailing list)
Hello Donald,

2007/1/22, Ball, Donald A Jr (Library) <removed_email_address@domain.invalid>:
> 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/
This topic is locked and can not be replied to.