Skip to content

Instantly share code, notes, and snippets.

@snodgrass23
Last active December 14, 2015 01:48
Show Gist options
  • Save snodgrass23/5008422 to your computer and use it in GitHub Desktop.
Save snodgrass23/5008422 to your computer and use it in GitHub Desktop.
rails "or" query with near
remote_query = root.remote_opportunities_available?(company_type).where_values.last.to_sql
location_query = root.near(params[:location], params[:radius] || BranchSearch::DEFAULT_SEARCH_RADIUS).where_values.last
res = root.where(remote_query + " OR " + location_query)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment