X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/8fe18995964717ff6f88858291c6f464cc40397f..8db05481193bfb105c76cda40ea0617b5f10545e:/app/controllers/trace_controller.rb diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 771b1a032..8d9b670c5 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -63,7 +63,7 @@ class TraceController < ApplicationController @page_size = 20 @traces = @traces.visible - @traces = @traces.order("timestamp DESC") + @traces = @traces.order(:id => :desc) @traces = @traces.offset((@page - 1) * @page_size) @traces = @traces.limit(@page_size) @traces = @traces.includes(:user, :tags) @@ -95,15 +95,15 @@ class TraceController < ApplicationController @title = t "trace.view.title", :name => @trace.name else flash[:error] = t "trace.view.trace_not_found" - redirect_to :controller => "trace", :action => "list" + redirect_to :action => "list" end rescue ActiveRecord::RecordNotFound flash[:error] = t "trace.view.trace_not_found" - redirect_to :controller => "trace", :action => "list" + redirect_to :action => "list" end def create - if params[:trace] + if request.post? logger.info(params[:trace][:gpx_file].class.name) if params[:trace][:gpx_file].respond_to?(:read) @@ -170,7 +170,7 @@ class TraceController < ApplicationController else @title = t "trace.edit.title", :name => @trace.name - if params[:trace] + if request.post? && params[:trace] @trace.description = params[:trace][:description] @trace.tagstring = params[:trace][:tagstring] @trace.visibility = params[:trace][:visibility] @@ -264,7 +264,7 @@ class TraceController < ApplicationController new_trace = Trace.from_xml(request.raw_post) unless new_trace && new_trace.id == trace.id - fail OSM::APIBadUserInput.new("The id in the url (#{trace.id}) is not the same as provided in the xml (#{new_trace.id})") + raise OSM::APIBadUserInput.new("The id in the url (#{trace.id}) is not the same as provided in the xml (#{new_trace.id})") end trace.description = new_trace.description