Handle segments which do not exist correctly and indicate that the
authorTom Hughes <tom@compton.nu>
Fri, 27 Jul 2007 08:16:12 +0000 (08:16 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 27 Jul 2007 08:16:12 +0000 (08:16 +0000)
preconditions for the way are not met.

app/models/way.rb

index 9d2239d5ca642f616a65b93a6042ec38555f57fa..09d1dafa0adca5b320aaad2003b63c36b9d85e43 100644 (file)
@@ -189,7 +189,7 @@ class Way < ActiveRecord::Base
   def preconditions_ok?
     return false if self.segs.empty?
     self.segs.each do |n|
-      segment = Segment.find(n)
+      segment = Segment.find(:first, :conditions => ["id = ?", n])
       unless segment and segment.visible and segment.preconditions_ok?
         return false
       end