<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.
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�:
Tel�fono: 0034 645 70 77 35