# Drop down list

**URL:** <https://www.ruby-forum.com/t/drop-down-list/123593>\
**Category:** Rails\
**Created:** [December 19, 2007, 12:58am UTC](https://www.ruby-forum.com/t/drop-down-list/123593 "2007-12-19T00:58:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [December 19, 2007, 12:58am UTC](https://www.ruby-forum.com/t/drop-down-list/123593/1 "2007-12-19T00:58:50Z")

</div>

In my application I have 2 objects. An Item object and SubItem object.  
What I would like to do is make a single drop down list that has all of  
the Items in it, then if the item has a SubItem attached to it, then it  
will be displayed directly underneath that Item with some sort of  
indentation or marking to indicate that it is a SubItem. I don’t even  
know where to begin looking for this type of problem. Any ideas?

~Jeremy

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [December 19, 2007, 6:37am UTC](https://www.ruby-forum.com/t/drop-down-list/123593/2 "2007-12-19T06:37:24Z")

</div>

please let me know the table structure and relationship of Item and  
SubItems,so that i will digg out let you know the solution.

- mohan

Jeremy W. wrote:

> In my application I have 2 objects. An Item object and SubItem object.  
> What I would like to do is make a single drop down list that has all of  
> the Items in it, then if the item has a SubItem attached to it, then it  
> will be displayed directly underneath that Item with some sort of  
> indentation or marking to indicate that it is a SubItem. I don’t even  
> know where to begin looking for this type of problem. Any ideas?
> 
> ~Jeremy

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [December 19, 2007, 3:37pm UTC](https://www.ruby-forum.com/t/drop-down-list/123593/3 "2007-12-19T15:37:51Z")

</div>

Jeremy W. said the following on 18/12/07 06:58 PM:

> In my application I have 2 objects. An Item object and SubItem object.  
> What I would like to do is make a single drop down list that has all of  
> the Items in it, then if the item has a SubItem attached to it, then it  
> will be displayed directly underneath that Item with some sort of  
> indentation or marking to indicate that it is a SubItem. I don’t even  
> know where to begin looking for this type of problem. Any ideas?

See [Son of Suckerfish Dropdowns](http://www.htmldog.com/articles/suckerfish/dropdowns/)

It would be great if Tabnav (q.v.) could be adapted to use this!

## Failing that, something that reads in a .yaml file that specifies the menu 🙂

The nice part about being a pessimist is that you are constantly  
being either proven right or pleasantly surprised. – George F. Will

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [December 19, 2007, 6:31pm UTC](https://www.ruby-forum.com/t/drop-down-list/123593/4 "2007-12-19T18:31:28Z")

</div>

Anton A. wrote:

> Jeremy W. said the following on 18/12/07 06:58 PM:
> 
> > In my application I have 2 objects. An Item object and SubItem object.  
> > What I would like to do is make a single drop down list that has all of  
> > the Items in it, then if the item has a SubItem attached to it, then it  
> > will be displayed directly underneath that Item with some sort of  
> > indentation or marking to indicate that it is a SubItem. I don’t even  
> > know where to begin looking for this type of problem. Any ideas?
> 
> See [Son of Suckerfish Dropdowns](http://www.htmldog.com/articles/suckerfish/dropdowns/)
> 
> It would be great if Tabnav (q.v.) could be adapted to use this!
> 
> ## Failing that, something that reads in a .yaml file that specifies the menu 🙂
> 
> The nice part about being a pessimist is that you are constantly  
> being either proven right or pleasantly surprised. – George F. Will

Cool thanks. I didn’t think to do something like that. I was going more  
of the standard \<%= f.select(:item, Item.find(:all)) %\> style drop down,  
but this way could work too.
