]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/trace_controller.rb
Fix rubocop warnings
[rails.git] / app / controllers / trace_controller.rb
index b7c9ccd70061357f324af38446c84b53b89afa65..8d9b670c5eb4b9f8419b3c59e70ac9f6c3bcf9c2 100644 (file)
@@ -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)
@@ -103,7 +103,7 @@ class TraceController < ApplicationController
   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]