Stephen M. wrote in post #1035762:
I find in my controllers that I often want to respond to two types of
request for html in the same action:
1) A full page request in which the whole page should be rendered
2) A request in which a partial should be rendered without the whole
I have handled this by passing a parameter in the url to indicate which
one to return but that feels ugly and I wonder if there are better ways?
There are a few possibilities.
Say you wanted a standard products page and a partial to use on the
welcome page for displaying the top selling products:
1. Use a custom action on a single controller.
2. Use separate controllers. There nothing to say that models and
controllers must exists in a one-to-one relationship. You can have as
many controllers as you want for a single model.
3. Use separate formats. This is a good option in cases where you want
multiple HTML representations for a single resource. Say for example,
one for desktop browsers and one for mobile browsers.