From 2201a7ff32c7269ea32db455a2f038b02ea3cd4f Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 21 Apr 2009 21:51:02 +0000 Subject: [PATCH] Don't generate an IN condition with an empty list. --- app/controllers/trace_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 = ?" -- 2.43.2