]> git.openstreetmap.org Git - rails.git/blob - app/controllers/api/nodes/ways_controller.rb
Merge pull request #6394 from openstreetmap/dependabot/github_actions/ruby/setup...
[rails.git] / app / controllers / api / nodes / ways_controller.rb
1 # frozen_string_literal: true
2
3 module Api
4   module Nodes
5     class WaysController < ApiController
6       authorize_resource
7
8       before_action :set_request_formats
9
10       ##
11       # returns all the ways which are currently using the node given in the
12       # :node_id parameter. note that this used to return deleted ways as well, but
13       # this seemed not to be the expected behaviour, so it was removed.
14       def index
15         @ways = Way
16                 .visible
17                 .where(:id => WayNode.where(
18                   :node_id => params[:node_id]
19                 ).select(:way_id))
20
21         # Render the result
22         respond_to do |format|
23           format.xml
24           format.json
25         end
26       end
27     end
28   end
29 end