teamsnap/pygmy — pull request #3 by bluefocus (2014-08-05 19:53:05+00:00)
Title: adding ability to do conditional searches…

via hierarchically ordered processor hashes

In the following configuration,
if `params[:team_id]` is present and
if `params[:is_manager]` is present and truthy
or `params[is_owner]` is present and truthy
the search method called on `MemberMapper` will be `#find_managers_by_team_id` or `#find_owners_by_team_id` instead of `#find_by_team_id`

The managers scope will be given preference over the owners scope due to it’s appearance first in the processors array

```ruby
include Pygmy.search(MemberMapper, :search_conditions => [
:id, :user_id,
{:for => :team_id, :processors => [
{:if => :is_manager, :scope => :managers},
{:if => :is_owner, :scope => :owners}
]}
])
```