Skip to content

Instantly share code, notes, and snippets.

@vilusa
Last active September 2, 2020 07:39
Show Gist options
  • Select an option

  • Save vilusa/20448f6601a561da9e315aa4dec2955d to your computer and use it in GitHub Desktop.

Select an option

Save vilusa/20448f6601a561da9e315aa4dec2955d to your computer and use it in GitHub Desktop.
query present helper
def query_present?(array)
query = params[:q]
return false if query.nil?
query = query.permit!.to_h
query.any? do |key, value|
key.to_s.in?(array) && value.present?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment