# Filtering one data set based on user action from another controller

**URL:** <https://www.ruby-forum.com/t/filtering-one-data-set-based-on-user-action-from-another-controller/144593>\
**Category:** Rails\
**Created:** [July 31, 2008, 9:58am UTC](https://www.ruby-forum.com/t/filtering-one-data-set-based-on-user-action-from-another-controller/144593 "2008-07-31T09:58:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://www.ruby-forum.com/u/ryan)\
**Post date:** [July 31, 2008, 9:58am UTC](https://www.ruby-forum.com/t/filtering-one-data-set-based-on-user-action-from-another-controller/144593/1 "2008-07-31T09:58:58Z")

</div>

Hello,

I am trying to filter the results of one controller based on the  
selection (not as a drop-down list) by the user resulting from a click  
from the results of another data set (anotherer controller).

For example, I have albums displayed across the top of all pages (as a  
partial inserted in the layout) with the code:

\<% for album in get\_albums %\>  
\<%= (album.name) %\>&nbsp;|&nbsp;  
\<% end %\>

I want the user to be able to click on one of these albums and only  
have the pictures from that album displayed below (pictures would be  
coming from the picture controller).

What is the best way to store the result of the user click on the  
different album name, and then, how do I then get the picture  
controller to use that selected album and only return the associated  
pics?

Thanks, I’ve been looking for the last couple of days for an answer  
but haven’t been able to come up with one, any advice would be  
appreciated.

Thanks,Ryan
