I’d like to add some filter choices to display a list of items. These
items has some boolean fields for example, and would like to have a
checkbox at the top of the window to let me select how to filter the
list.
here’s what i put in my controller
if @params[:filter].nil?
@params[:filter] = { ‘sent’ => “1”}
end
… generate the corresponding @items array …
here’s what i did in my view
<%= form_tag :action => ‘list_items’ %>
<%= check_box ‘filter’,‘sent’ %>
<%= submit_tag ‘Filter’ %>
<%= end_form_tag %>
inspecting the @params value, it seems to has a filter[:sent] key,
with the correct value (1 if checked) but the check button is always
unchecked when the page is generated.
Am i so wrong doing this? is there a better way?