Forum: Ruby on Rails Custom Site Rule

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
66f8deb95f8174885c85592e8c86377c?d=identicon&s=25 Keith Davey (Guest)
on 2007-05-14 23:17
(Received via mailing list)

I am looking for an approach to do the following.

I have an app which will serve multiple accounts. In many cases they
will use the same views.

The public part of each account is served by a public controller, so I
have an app/views/public/index.rhtml for instance.

In certain cases there will be a custom version of these pages for
accounts. I would like to  be able set up something like

Is there an easy way to redirect the request so the correct view is
used. I was thinking of routes but its looking for more like a coding


8e9784d64e195904153512fd08ebe73f?d=identicon&s=25 Chewbie (Guest)
on 2007-05-15 05:53
(Received via mailing list)

For what I understand I'm not sure you can do it by using routes.
Perhaps you can if each type of account have a special controller,
then in your routes you would have to redirect the /
special_account_controller/action/someid to the correct view. If there
is no special controller I'm not sure you can do it with the routes
since I don't see how you would know the current type of account

If there is no special controller for each account then you can check
the type of account in the controller and make a redirect if
Perhaps you can directly link in your view themselves to the righ next
view (using some helper then else it will be messy quite quickly).
I think if I were you I would use the second option and make one big
helper taking the view trying to achieve, the type of account and then
retourning the correct view. That seems the most DRY way.

My 2 cents.
This topic is locked and can not be replied to.