Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get back to the .search_by method
def search_by params = {}
params = params.try(:symbolize_keys) || {}
collection = page(params[:page])
if params[:term].present?
collection = collection.where('name ILIKE ?', "#{ params[:term] }%")
end
collection
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment