Hobo Cookbook

View Source



A <select> menu intended to act as a filter for index pages.


Filtering on state is a common use. Here’s the dryml for Order:

<filter-menu param-name="state" options="&Order::Lifecycle.states.keys" />

And the controller action:

def index
  # always validate data given in URL's!!!
  params[:state]=nil unless Order::Lifecycle.states.include?(params[:state]._?.to_sym)
  finder = params[:state] ? Order.send(params[:state]) : Order
  hobo_index finder

See Filtering stories by status in the Agility Tutorial for an example.


  • param-name - the name of the HTTP parameter to use for the filter
  • options - an array of options for the menu.
  • no-filter - The text of the first option which indicates no filter is in effect. Defaults to ‘All’

Show Source


No comments to display