Skip to content

Instantly share code, notes, and snippets.

@xeago
Forked from anonymous/retire.rb
Last active December 28, 2015 19:49
Show Gist options
  • Save xeago/7552918 to your computer and use it in GitHub Desktop.
Save xeago/7552918 to your computer and use it in GitHub Desktop.
terms = []
terms += { term: { category_id: params[:category_id] } } if params[:category_id].present?
# etc
filter :and, terms if not terms.empty?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment