more way bits
This commit is contained in:
parent
7c1b6e850d
commit
b95e9d2759
9 changed files with 97 additions and 4 deletions
|
@ -28,7 +28,7 @@ class NodeController < ApplicationController
|
|||
|
||||
def rest
|
||||
unless Node.exists?(params[:id])
|
||||
render :nothing => true, :status => 400
|
||||
render :nothing => true, :status => 404
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class SegmentController < ApplicationController
|
|||
|
||||
def rest
|
||||
unless Segment.exists?(params[:id])
|
||||
render :nothing => true, :status => 400
|
||||
render :nothing => true, :status => 404
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -26,4 +26,33 @@ class WayController < ApplicationController
|
|||
render :nothing => true, :status => 500 # something went very wrong
|
||||
end
|
||||
|
||||
def rest
|
||||
unless Way.exists?(params[:id])
|
||||
render :nothing => true, :status => 404
|
||||
return
|
||||
end
|
||||
|
||||
way = Way.find(params[:id])
|
||||
case request.method
|
||||
|
||||
when :get
|
||||
unless way.visible
|
||||
render :nothing => true, :status => 410
|
||||
return
|
||||
end
|
||||
render :text => way.to_xml.to_s
|
||||
|
||||
when :delete
|
||||
unless way.visible
|
||||
render :nothing => true, :status => 410
|
||||
return
|
||||
end
|
||||
|
||||
way.visible = false
|
||||
way.save_with_history
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
2
app/controllers/way_segment_controller.rb
Normal file
2
app/controllers/way_segment_controller.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
class WaySegmentController < ApplicationController
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue