Make sure we order user changeset correctly for browse#changeset
authorTom Hughes <tom@compton.nu>
Sun, 3 Nov 2013 12:40:01 +0000 (12:40 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 3 Nov 2013 12:40:01 +0000 (12:40 +0000)
app/controllers/browse_controller.rb

index 0103516..1197921 100644 (file)
@@ -70,8 +70,8 @@ class BrowseController < ApplicationController
     @prev = Changeset.where("id < ?", @changeset.id).order(:id => :desc).first
 
     if @changeset.user.data_public?
-      @next_by_user = @changeset.user.changesets.where("id > ?", @changeset.id).order(:id => :asc).first
-      @prev_by_user = @changeset.user.changesets.where("id < ?", @changeset.id).order(:id => :desc).first
+      @next_by_user = @changeset.user.changesets.where("id > ?", @changeset.id).reorder(:id => :asc).first
+      @prev_by_user = @changeset.user.changesets.where("id < ?", @changeset.id).reorder(:id => :desc).first
     end
   rescue ActiveRecord::RecordNotFound
     render :action => "not_found", :status => :not_found