]> git.openstreetmap.org Git - rails.git/commitdiff
Pass parameters to APIAlreadyDeletedError correctly
authorTom Hughes <tom@compton.nu>
Tue, 5 Feb 2013 17:43:43 +0000 (17:43 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 5 Feb 2013 18:08:11 +0000 (18:08 +0000)
app/controllers/notes_controller.rb

index 1f5b990cc818cd2cc9c008da0dceaed88bb4f87f..a7fa03ac7e94e076eaf133099581c807018c522b 100644 (file)
@@ -93,7 +93,7 @@ class NotesController < ApplicationController
     # Find the note and check it is valid
     @note = Note.find(id)
     raise OSM::APINotFoundError unless @note
-    raise OSM::APIAlreadyDeletedError unless @note.visible?
+    raise OSM::APIAlreadyDeletedError.new("note", @note.id) unless @note.visible?
 
     # Add a comment to the note
     Note.transaction do
@@ -120,7 +120,7 @@ class NotesController < ApplicationController
     # Find the note and check it is valid
     @note = Note.find_by_id(id)
     raise OSM::APINotFoundError unless @note
-    raise OSM::APIAlreadyDeletedError unless @note.visible?
+    raise OSM::APIAlreadyDeletedError.new("note", @note.id) unless @note.visible?
 
     # Close the note and add a comment
     Note.transaction do
@@ -170,8 +170,8 @@ class NotesController < ApplicationController
     # Find the note and check it is valid
     @note = Note.find(params[:id])
     raise OSM::APINotFoundError unless @note
-    raise OSM::APIAlreadyDeletedError unless @note.visible?
-    
+    raise OSM::APIAlreadyDeletedError.new("note", @note.id) unless @note.visible?
+
     # Render the result
     respond_to do |format|
       format.xml
@@ -193,7 +193,7 @@ class NotesController < ApplicationController
     # Find the note and check it is valid
     note = Note.find(id)
     raise OSM::APINotFoundError unless note
-    raise OSM::APIAlreadyDeletedError unless note.visible?
+    raise OSM::APIAlreadyDeletedError.new("note", note.id) unless note.visible?
 
     # Mark the note as hidden
     Note.transaction do