]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/node_controller.rb
Adding 'New diary post' link to main Users' diaries page to help logged-in users...
[rails.git] / app / controllers / node_controller.rb
index fba41e3305dc16c59eec00561027f09441a9f983..4e2a9b7f22a9f532303eecdd8098928bb36f5f19 100644 (file)
@@ -1,6 +1,7 @@
 class NodeController < ApplicationController
   require 'xml/libxml'
 
+  session :off
   before_filter :authorize, :only => [:create, :update, :delete]
   before_filter :check_availability, :only => [:create, :update, :delete]
   after_filter :compress_output
@@ -12,12 +13,9 @@ class NodeController < ApplicationController
       if node
         node.user_id = @user.id
         node.visible = true
+        node.save_with_history!
 
-        if node.save_with_history
-          render :text => node.id.to_s, :content_type => "text/plain"
-        else
-          render :nothing => true, :status => :internal_server_error
-        end
+        render :text => node.id.to_s, :content_type => "text/plain"
       else
         render :nothing => true, :status => :bad_request
       end
@@ -37,8 +35,6 @@ class NodeController < ApplicationController
       end
     rescue ActiveRecord::RecordNotFound
       render :nothing => true, :status => :not_found
-    rescue
-      render :nothing => true, :status => :internal_server_error
     end
   end
 
@@ -54,12 +50,9 @@ class NodeController < ApplicationController
           node.latitude = new_node.latitude 
           node.longitude = new_node.longitude
           node.tags = new_node.tags
+          node.save_with_history!
 
-          if node.save_with_history
-            render :nothing => true
-          else
-            render :nothing => true, :status => :internal_server_error
-          end
+          render :nothing => true
         else
           render :nothing => true, :status => :bad_request
         end
@@ -68,8 +61,6 @@ class NodeController < ApplicationController
       end
     rescue ActiveRecord::RecordNotFound
       render :nothing => true, :status => :not_found
-    rescue
-      render :nothing => true, :status => :internal_server_error
     end
   end
 
@@ -83,7 +74,8 @@ class NodeController < ApplicationController
         else
           node.user_id = @user.id
           node.visible = 0
-          node.save_with_history
+          node.save_with_history!
+
           render :nothing => true
         end
       else
@@ -91,8 +83,6 @@ class NodeController < ApplicationController
       end
     rescue ActiveRecord::RecordNotFound
       render :nothing => true, :status => :not_found
-    rescue
-      render :nothing => true, :status => :internal_server_error
     end
   end