Hi,
When passing custom options to select_menu I usually use "map". Try this
and see if it works:
<select-menu name="category" selected='&selected' first-option="All
Categories" options="&Category.all.map{|category|
[category.name, category.id]}"" />
There's also an old post discussing something similar:
https://groups.google.com/forum/#!topic/hobousers/yIz5I7k3Zoo
Regards,
Ignacio
El 15/01/13 00:38, tonym escribió:
Hi All,
Been scratching my head over this one for a while.
I'm using a select menu as a set of filters. nothing special, just
passing them as params...
<def tag="searchform">
<form class="filter-menu searchform" action="/categories/" method="GET" >
<select-menu name="category" selected='&selected' first-option="All
Categories" options="&Category.all" />
<select-menu name="area" selected='&selected'
first-option="Anywhere In Sheffield" options="&LocalArea.all" />
<select-menu name="day" selected='&selected'
options="&day_filter_options" />
<button type="submit" id="main_srch" class="btn">Search</button>
</form>
</def>
Problem is, the select menu /values/ are being populated with the name
string, not the model's id.
Works perfectly for the hash pairs I've built for the
day_filter_options, but not for the models.
Any help would be greatly appreciated.
Cheers, Anthony.
--
You received this message because you are subscribed to the Google
Groups "Hobo Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hobousers/-/dhlNUczdtesJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.
--
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.