Hi,
I am trying to figure out what the best practice for the following
problem might be: In my RoR app, I have an account class, and the user
has to have the ability to edit it (e.g., change the email address). At
the same time, I want to give an admin the chance to edit it, because,
well, the targeted users might not be clever enough to do everything on
their own
Of course, the editing pages should look differently (different menu,
and also a different redirect after editing is complete). As a rails
newbie, I can figure out two basic ways of doing this:
- use the same controller, and change the page layout and redirect_to
according to some information stored in the session - use the same view, and have a different controller and layout for the
user and the admin
I am not quite sure which way should be preferred - the first one
amounts to some case distinctions in the view and the controller, which
I do not like too much, and the second one produces redundant code in
the two controllers. Any suggestions, or maybe even a third possibility?
Thank you very much!