Custom Site Rule


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




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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs