Topic: DRY site for multiple user types/roles

Hi All,

I wanted to solicit feedback on what the best way to go about organizing a site which will have multiple user types, each with a very different view of the application. There are some conflicting goals when doing this, namely:

- There are 3 different user types
- Want to remain RESTful (only 7 actions)
- DRY
- Don't want to put too much logic in the views
- Want to show users different things when they visit some Actions (some are the same, some very different)
- Keep the application flexible

So, if each user type should see something different when they visit a URL, should I

1. put logic in the controller which renders a different template depending on the user type.  (so maybe have role1_show.html.erb, role2_show.html.erb, etc)
2. put logic in the view to render different things depending on the user type (this isn't as bad as it may seem since 80-90% on average is re-use). This is hard because I don't want to have too much logic in the controllers and the views for one user type can break when I change something in the controller for a different user type.
3. implement different controllers for each user type (I've never heard of someone doing this, but I just it might be a possible solution)
4. Something amazing I haven't thought of...

Thanks for your suggestions.

Re: DRY site for multiple user types/roles

I'd do option 1

Another thing I'd check out is the make_resourceful plugin:

http://www.railslodge.com/plugins/807-make-resourceful

That could be very handy in your case, not sure if it works on 3.0 though

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: DRY site for multiple user types/roles

@BradHodges

Thanks for the opinion.
I think the new version of that plugin is InheritedResources

Re: DRY site for multiple user types/roles

looks like a different plugin,  but does the same basic thing,  I used make_resourceful and it was very handy indeed!

The name InheritedResource is much more fitting to it's function

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.