]> git.openstreetmap.org Git - rails.git/commitdiff
Don't generate an IN condition with an empty list.
authorTom Hughes <tom@compton.nu>
Tue, 21 Apr 2009 21:51:02 +0000 (21:51 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 21 Apr 2009 21:51:02 +0000 (21:51 +0000)
app/controllers/trace_controller.rb

index cabbb4ff90f916763b3f48cf7a76da9b22453151..47a31d314e5b42fcce1ebe41a5774f49c2373808 100644 (file)
@@ -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 = ?"