]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/ways_controller.rb
Merge branch 'master' into tag-colour-preview-rebase
[rails.git] / app / controllers / api / ways_controller.rb
index 04c823ad2a40e2b5db5835509688baf3c2da8b79..9af087d83a31fb06de92ce0a5718f9aa10225cd7 100644 (file)
@@ -22,17 +22,13 @@ module Api
     end
 
     def show
-      way = Way.find(params[:id])
-
-      response.last_modified = way.timestamp
+      @way = Way.find(params[:id])
 
-      if way.visible
-        @way = way
+      response.last_modified = @way.timestamp
 
+      if @way.visible
         # Render the result
-        respond_to do |format|
-          format.xml
-        end
+        render :formats => [:xml]
       else
         head :gone
       end
@@ -64,28 +60,22 @@ module Api
     end
 
     def full
-      way = Way.includes(:nodes => :node_tags).find(params[:id])
+      @way = Way.includes(:nodes => :node_tags).find(params[:id])
 
-      if way.visible
+      if @way.visible
         visible_nodes = {}
-        # changeset_cache = {}
-        # user_display_name_cache = {}
 
         @nodes = []
 
-        way.nodes.uniq.each do |node|
+        @way.nodes.uniq.each do |node|
           if node.visible
             @nodes << node
             visible_nodes[node.id] = node
           end
         end
 
-        @way = way
-
         # Render the result
-        respond_to do |format|
-          format.xml
-        end
+        render :formats => [:xml]
       else
         head :gone
       end
@@ -103,9 +93,7 @@ module Api
       @ways = Way.find(ids)
 
       # Render the result
-      respond_to do |format|
-        format.xml
-      end
+      render :formats => [:xml]
     end
 
     ##
@@ -118,9 +106,7 @@ module Api
       @ways = Way.where(:id => wayids, :visible => true)
 
       # Render the result
-      respond_to do |format|
-        format.xml
-      end
+      render :formats => [:xml]
     end
   end
 end