# Multiple views for the same action?

**URL:** <https://www.ruby-forum.com/t/multiple-views-for-the-same-action/139121>\
**Category:** Rails\
**Created:** [May 31, 2008, 1:02am UTC](https://www.ruby-forum.com/t/multiple-views-for-the-same-action/139121 "2008-05-31T01:02:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danimal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@Danimal](https://www.ruby-forum.com/u/Danimal)\
**Post date:** [May 31, 2008, 1:02am UTC](https://www.ruby-forum.com/t/multiple-views-for-the-same-action/139121/1 "2008-05-31T01:02:56Z")

</div>

So I’m looking for best practices, advice, feedback, etc. on this.

How do you handle multiple views for the same action? How do you  
decide when one way is better than another?

If I have a view for an end-user and the same view for an admin, but  
some things are supposed to be different, how do you manage that well?

I know the basic functional ways, I’m just wondering about  
recommendations to keep it clean and as DRY as possible.

For example, if the difference is minimal, maybe wrap some code in the  
view itself. I.e. if showing a Foo and the admin should have an “edit  
foo” link but otherwise the display is the same, then I’d probably  
just wrap a role check or something in an if statement in the view.

But what about when it gets a little more complex… different  
content\_for blocks… different layout… even some different main  
content.

If they are radically different (the other extreme), I’d make two  
separate views and switch in the controller.

Thoughts?

-Danimal
