From: Tom Hughes Date: Sat, 7 Jun 2008 22:40:39 +0000 (+0000) Subject: Work around the fact that exists? no longer works for models with X-Git-Tag: live~7779 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/7d9bf3634c07e37bc1d2ff15a36f9c21f36d7c41 Work around the fact that exists? no longer works for models with no primary key. --- diff --git a/app/models/trace.rb b/app/models/trace.rb index 0e9e7bcc1..d28c2c6f4 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -183,7 +183,7 @@ class Trace < ActiveRecord::Base # If there are any existing points for this trace then delete # them - we check for existing points first to avoid locking # the table in the common case where there aren't any. - if Tracepoint.exists?(['gpx_id = ?', self.id]) + if Tracepoint.find(:first, :conditions => ['gpx_id = ?', self.id]) Tracepoint.delete_all(['gpx_id = ?', self.id]) end