From: Tom Hughes Date: Tue, 21 Apr 2009 21:51:02 +0000 (+0000) Subject: Don't generate an IN condition with an empty list. X-Git-Tag: live~7549 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/2201a7ff32c7269ea32db455a2f038b02ea3cd4f?ds=inline Don't generate an IN condition with an empty list. --- diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index cabbb4ff9..47a31d314 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -57,7 +57,10 @@ class TraceController < ApplicationController @tag = params[:tag] files = Tracetag.find_all_by_tag(params[:tag]).collect { |tt| tt.gpx_id } - conditions[0] += " AND gpx_files.id IN (#{files.join(',')})" + + if files.length > 0 + conditions[0] += " AND gpx_files.id IN (#{files.join(',')})" + end end conditions[0] += " AND gpx_files.visible = ?"