]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/amf_controller.rb
Most of a method to delete a way and all its nodes - but I'm waiting on splitting...
[rails.git] / app / controllers / amf_controller.rb
index 471e2fadabdbbcccca7b19e5916e2d1b83c9ea22..e83ed4bb1c0239f9ae4779eb0c89610084f27524 100644 (file)
@@ -559,9 +559,10 @@ class AmfController < ApplicationController
     ActiveRecord::Base.connection.select_all(sql)
   end
 
+  # Get the latest version id of a way
   def getlastversion(id,version) #:doc:
-    row=ActiveRecord::Base.connection.select_one("SELECT version FROM ways WHERE id=#{id} AND visible=1 ORDER BY version DESC LIMIT 1")
-    row['version']
+    old_way = OldWay.find(:first, :conditions => ['id = ?' , id], :order => 'version DESC')
+    old_way.version
   end
 
   def readwayquery_old(id,version,historic) #:doc: