# Using view from different controller

**URL:** <https://www.ruby-forum.com/t/using-view-from-different-controller/151261>\
**Category:** Rails\
**Created:** [October 18, 2008, 11:36pm UTC](https://www.ruby-forum.com/t/using-view-from-different-controller/151261 "2008-10-18T23:36:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![corck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/90db22/32.png) [@corck](https://www.ruby-forum.com/u/corck)\
**Post date:** [October 18, 2008, 11:36pm UTC](https://www.ruby-forum.com/t/using-view-from-different-controller/151261/1 "2008-10-18T23:36:29Z")

</div>

Hi,  
I (newbie) work on an application that uses the last.fm api and request  
the top albums from Last.fm.

so I have a lastfm\_controller with the action  
caches\_view: top\_albums

def top\_albums  
get\_albums(params[artist])  
#gets top albums from  
end

and a top\_albums.rhtml that renders a list of the albums. I want to  
cache the view, what works well.

Now i have another mediaplayer\_controller that gets the current artist  
from my media player.

def get\_mediaplayer\_artist  
@artist = getmediaplayer.artist  
end

In the mediaplayer.rhtml I want to include lastfm functionality.  
How can I include the /lastfm/top\_albums/ARTIST view in the  
mediaplayer.rhtml.

I tried to move everything to the mediaplayer\_controller, and use the  
render call, however then I have no caching.

I hope its understandable. My main problem is that I need the caching  
functionality of the lastfm actions.

thanks
