Skip to content

Instantly share code, notes, and snippets.

@mikecmpbll
Forked from anonymous/example.rb
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikecmpbll/1bb59e596591c68bf229 to your computer and use it in GitHub Desktop.
Save mikecmpbll/1bb59e596591c68bf229 to your computer and use it in GitHub Desktop.
search_all = LOCAL_SETTINGS["single_site_search"]
if params[:ref].present?
spaces = Space.where(id: { params[:ref] }, parent_id: nil })
spaces = spaces.eager_loads(slots: :companies).where(companies: { parent_id: current_company_id }) unless search_all
render partial: 'call_centre_results' and return
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment