]> git.openstreetmap.org Git - rails.git/blob - app/controllers/api/nodes/ways_controller.rb
Replace abbreviation with for example in CONTRIBUTING md
[rails.git] / app / controllers / api / nodes / ways_controller.rb
1 module Api
2   module Nodes
3     class WaysController < ApiController
4       authorize_resource
5
6       before_action :set_request_formats
7
8       ##
9       # returns all the ways which are currently using the node given in the
10       # :node_id parameter. note that this used to return deleted ways as well, but
11       # this seemed not to be the expected behaviour, so it was removed.
12       def index
13         way_ids = WayNode.where(:node_id => params[:node_id]).collect { |ws| ws.id[0] }.uniq
14
15         @ways = Way.where(:id => way_ids, :visible => true)
16
17         # Render the result
18         respond_to do |format|
19           format.xml
20           format.json
21         end
22       end
23     end
24   end
25 end