On May 2, 2010, at 3:06 AM, storitel wrote:
hi all this must be an easy one ... i've got a <filter-menu> working,
but I want to make it default to something other than All ... is there
a simple trick for this or do I have to fully get my head around
named_scopes? :-)
Depends - what do you mean by "default to something"? If you just want
to change the *label* that says "All", you can use the no-filter param:
http://cookbook.hobocentral.net/api_tag_defs/filter-menu
On the other hand, if you want the actual value to default to
something different, you can just fix it in the controller:
def index
params[:some_filter_param] ||= 'some_value'
...
end
Assuming the definition matches up, you'll get the filter-menu set to
the correct value whenever you don't pass in a param.
I use an identical trick to force a sort order on table-plus
(especially when sorting records that belong_to :user).
--Matt Jones
--
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.