# Keeping search selections

**URL:** <https://www.ruby-forum.com/t/keeping-search-selections/88785>\
**Category:** Rails\
**Created:** [March 14, 2007, 11:09am UTC](https://www.ruby-forum.com/t/keeping-search-selections/88785 "2007-03-14T11:09:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nyxx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/13edae/32.png) [@nyxx](https://www.ruby-forum.com/u/nyxx)\
**Post date:** [March 14, 2007, 11:09am UTC](https://www.ruby-forum.com/t/keeping-search-selections/88785/1 "2007-03-14T11:09:33Z")

</div>

Hey people,

I was wondering if there’s an easy way in rails to have select dropdowns  
keep the option that was selected before a search is performed.  
According to someone I work with it is possible to do this in an easy  
way in rails, so I hope anyone can point me in the right direction…

Many thanks,

Danny

---

<div class="post-metadata">

**Author:** ![nyxx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/13edae/32.png) [@nyxx](https://www.ruby-forum.com/u/nyxx)\
**Post date:** [March 14, 2007, 1:15pm UTC](https://www.ruby-forum.com/t/keeping-search-selections/88785/2 "2007-03-14T13:15:41Z")

</div>

I’m just guessing here but sounds like sessions or cookies, probably  
sessions, is the key. Anyone got experience with this? I dunno myself.

RSL

On 3/14/07, Daniel Owen van Dommelen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![nyxx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/13edae/32.png) [@nyxx](https://www.ruby-forum.com/u/nyxx)\
**Post date:** [March 14, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/keeping-search-selections/88785/3 "2007-03-14T13:51:40Z")

</div>

Russell N. wrote:

> I’m just guessing here but sounds like sessions or cookies, probably  
> sessions, is the key. Anyone got experience with this? I dunno myself.
> 
> RSL
> 
> On 3/14/07, Daniel Owen van Dommelen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Yes, this options, while it’s probably possible to go this way, I would  
really like to find a cleaner method to do so. The problem is that the  
selects are generated using rails helper methods and the options are  
automatically generated from arrays defined in application\_helper.rb.  
This makes it so I can’t use a for loop or whatever to check if the  
current equals the stored session/cookie data… I am SO sure  
rails must have thought of this before…

thanks anyway though…
