Don't generate an IN condition with an empty list.

This commit is contained in:
Tom Hughes 2009-04-21 21:51:02 +00:00
parent e192c77986
commit 2201a7ff32

View file

@ -57,8 +57,11 @@ class TraceController < ApplicationController
@tag = params[:tag]
files = Tracetag.find_all_by_tag(params[:tag]).collect { |tt| tt.gpx_id }
if files.length > 0
conditions[0] += " AND gpx_files.id IN (#{files.join(',')})"
end
end
conditions[0] += " AND gpx_files.visible = ?"
conditions << true