What is the correct way to set up a boolean filter on a table-plus?  I
need the yes, no, and all options.  I hacked up something that works
starting with the Agility sample but I'm scratching my head thinking
there might be a cleaner approach.

In application.dryml:

<extend tag="index-page" for="Contact">
  <old-index-page merge>
    <collection: replace>
      <div>
        <br/>
        <table-plus  fields="this, street, city, state, may_call,
may_mail, may_email">
          <prepend-header:>
            <div class="filter">
              May EMail: <filter-menu param-name="may_email" options="&
['Yes', 'No']" />
            </div>
          </prepend-header:>
          <empty-message:>No contacts match your criteria</empty-
message:>
        </table-plus>
      </div>
    </collection:>
  </old-index-page>
</extend>

In contacts_controller.rb:

  def index
      scopes = {
        :search => [params[:search], :name],
        :order_by => parse_sort_param
(:name, :street, :city, :state, :may_call, :may_mail, :may_email)
      }
      scopes[:may_email] = true if params[:may_email]._?.== 'Yes'
      scopes[:not_may_email] = true if params[:may_email]._?.== 'No'
      hobo_index Contact.apply_scopes(scopes)
  end



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to