around_action :api_call_handle_error
def show
- trace = Trace.visible.find(params[:id])
+ @trace = Trace.visible.find(params[:id])
- if trace.public? || trace.user == current_user
- @traces = [trace]
- render "trace"
- else
- head :forbidden
- end
+ head :forbidden unless @trace.public? || @trace.user == current_user
end
def update
def gpx_files
@traces = current_user.traces.reload
- render "api/traces/trace", :content_type => "application/xml"
+ render :content_type => "application/xml"
end
private
--- /dev/null
+xml.instruct! :xml, :version => "1.0"
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+ osm << render(@trace)
+end
xml.instruct! :xml, :version => "1.0"
-# basic attributes
-
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
@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