Skip to content

Instantly share code, notes, and snippets.

Created July 24, 2014 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/bb9b75d12b55bd39cb41 to your computer and use it in GitHub Desktop.
Save anonymous/bb9b75d12b55bd39cb41 to your computer and use it in GitHub Desktop.
search_all = LOCAL_SETTINGS["single_site_search"]
# actaully do the search - and get a list of id's
if params[:ref].to_s.length > 0
if search_all
session[:search_cond] = ["spaces.id = ? and spaces.parent_id IS NULL", params[:ref]]
else
session[:search_cond] = ["spaces.id = ? and companies.parent_id = ? and spaces.parent_id IS NULL", params[:ref], current_company_id]
end
render :partial=>'call_centre_results'
return
end
if params[:member_reference].to_s.length > 0
sd = SpaceDetail.where(value: params[:member_reference])
if search_all
arr = []
sd.each do |s|
arr << s.space.id if s.space.present?
if s.member
s.member.spaces.each do |x|
arr << x.id
end
end
end
session[:search_cond] = ["spaces.id = ? and companies.parent_id = ? ", arr, current_company_id]
else
arr = []
sd.each do |s|
arr << s.space.id if s.space.present?
if s.member
s.member.spaces.each do |x|
arr << x.id
end
end
end
session[:search_cond] = ["spaces.id = ? and companies.parent_id = ? ", arr, current_company_id]
end
render :partial=>'call_centre_results'
return
end
Mysql2::Error: Operand should contain 1 column(s): SELECT COUNT(DISTINCT `spaces`.`id`) FROM `spaces` LEFT OUTER JOIN `slots` ON `slots`.`id` = `spaces`.`slot_id` LEFT OUTER JOIN `companies` ON `companies`.`id` = `slots`.`company_id` WHERE (spaces.id = 3556045,3584098
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment