]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/browse_controller.rb
Fix exception with GPX and RSS notes#index when no notes are found
[rails.git] / app / controllers / browse_controller.rb
index e5557280e6ee7f4824a2c8144fbfefebe1c28c6a..5526aacca05df6de55bb8c7087662dcaea829db2 100644 (file)
@@ -76,4 +76,13 @@ class BrowseController < ApplicationController
   rescue ActiveRecord::RecordNotFound
     render :action => "not_found", :status => :not_found
   end
+
+  def note
+    @type = "note"
+    @note = Note.find(params[:id])
+    @next = Note.find(:first, :order => "id ASC", :conditions => [ "status != 'hidden' AND id > :id", { :id => @note.id }] )
+    @prev = Note.find(:first, :order => "id DESC", :conditions => [ "status != 'hidden' AND id < :id", { :id => @note.id }] )
+  rescue ActiveRecord::RecordNotFound
+    render :action => "not_found", :status => :not_found
+  end
 end