Rework to ensure views are named after the controller method name
This commit is contained in:
parent
17e6e69c39
commit
c24b0e9399
4 changed files with 9 additions and 11 deletions
|
@ -16,14 +16,9 @@ module Api
|
||||||
around_action :api_call_handle_error
|
around_action :api_call_handle_error
|
||||||
|
|
||||||
def show
|
def show
|
||||||
trace = Trace.visible.find(params[:id])
|
@trace = Trace.visible.find(params[:id])
|
||||||
|
|
||||||
if trace.public? || trace.user == current_user
|
head :forbidden unless @trace.public? || @trace.user == current_user
|
||||||
@traces = [trace]
|
|
||||||
render "trace"
|
|
||||||
else
|
|
||||||
head :forbidden
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
@ -38,7 +38,7 @@ module Api
|
||||||
|
|
||||||
def gpx_files
|
def gpx_files
|
||||||
@traces = current_user.traces.reload
|
@traces = current_user.traces.reload
|
||||||
render "api/traces/trace", :content_type => "application/xml"
|
render :content_type => "application/xml"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
5
app/views/api/traces/show.builder
Normal file
5
app/views/api/traces/show.builder
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
xml.instruct! :xml, :version => "1.0"
|
||||||
|
|
||||||
|
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||||
|
osm << render(@trace)
|
||||||
|
end
|
|
@ -1,9 +1,7 @@
|
||||||
xml.instruct! :xml, :version => "1.0"
|
xml.instruct! :xml, :version => "1.0"
|
||||||
|
|
||||||
# basic attributes
|
|
||||||
|
|
||||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||||
@traces.each do |trace|
|
@traces.each do |trace|
|
||||||
osm << render(:partial => "api/traces/trace.builder", :locals => { :trace => trace })
|
osm << render(:partial => "api/traces/trace", :locals => { :trace => trace })
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Add table
Add a link
Reference in a new issue