]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/trace_controller.rb
Only add traces for POST requests
[rails.git] / app / controllers / trace_controller.rb
index 60b5a4585330309f5c7aa1bf873ae6e5fe220dea..e41bd01f31008e4bcf1c1c204555569b874c5350 100644 (file)
@@ -63,7 +63,7 @@ class TraceController < ApplicationController
     @page_size = 20
 
     @traces = @traces.visible
     @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)
     @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"
       @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"
     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
   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)
       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
 
     else
       @title = t "trace.edit.title", :name => @trace.name
 
-      if params[:trace]
+      if request.post?
         @trace.description = params[:trace][:description]
         @trace.tagstring = params[:trace][:tagstring]
         @trace.visibility = params[:trace][:visibility]
         @trace.description = params[:trace][:description]
         @trace.tagstring = params[:trace][:tagstring]
         @trace.visibility = params[:trace][:visibility]