Move the ActiveRecord::RecordNotFound to the block, so that it catches the not found...
authorShaun McDonald <shaun@shaunmcdonald.me.uk>
Wed, 14 Jan 2009 00:17:42 +0000 (00:17 +0000)
committerShaun McDonald <shaun@shaunmcdonald.me.uk>
Wed, 14 Jan 2009 00:17:42 +0000 (00:17 +0000)
app/controllers/amf_controller.rb

index ecc291e69224cc0e81b6e4ff7b1b9bb586d520eb..4103ceda002df16e47418f10d2a089219ef856eb 100644 (file)
@@ -344,18 +344,16 @@ class AmfController < ApplicationController
 RAILS_DEFAULT_LOGGER.info("** revision dates: #{revdates.inspect}")
 RAILS_DEFAULT_LOGGER.info("** range: #{revdates[-1]-revdates[0]}")
 
-    begin
-      history = Way.find(wayid).old_ways.reverse.collect do |old_way|
-        user_object = old_way.changeset.user
-        user = user_object.data_public? ? user_object.display_name : 'anonymous'
-        uid  = user_object.data_public? ? user_object.id : 0
-        [old_way.version, old_way.timestamp.strftime("%d %b %Y, %H:%M"), old_way.visible ? 1 : 0, user, uid]
-      end
-
-      return ['way',wayid,history]
-    rescue ActiveRecord::RecordNotFound
-      return ['way', wayid, []]
+    history = Way.find(wayid).old_ways.reverse.collect do |old_way|
+      user_object = old_way.changeset.user
+      user = user_object.data_public? ? user_object.display_name : 'anonymous'
+      uid  = user_object.data_public? ? user_object.id : 0
+      [old_way.version, old_way.timestamp.strftime("%d %b %Y, %H:%M"), old_way.visible ? 1 : 0, user, uid]
     end
+
+    return ['way',wayid,history]
+  rescue ActiveRecord::RecordNotFound
+    return ['way', wayid, []]
   end
 
   # Find history of a node. Returns 'node', id, and