Skip to content

Instantly share code, notes, and snippets.

@sevenseacat
Forked from baweaver/gist:f65117ba71667298afac
Last active August 29, 2015 14:05
Show Gist options
  • Save sevenseacat/9e729f2d5186b0d1f829 to your computer and use it in GitHub Desktop.
Save sevenseacat/9e729f2d5186b0d1f829 to your computer and use it in GitHub Desktop.
filters = {}
filters[:name] = params[:name] if params[:name]
filters[:age] = params[:age] if params[:age]
filters[:gender] = params[:gender] if params[:gender]
# or some computation or other process for each field here instead, to mimic functionality that a simple slice wouldnt replicate
Person.where(filters)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment