OSDN Git Service

Merge branch 'v06sheet' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06sheet
[pettanr/pettanr.git] / app / controllers / application_controller.rb
index 0f3fade..5c5b63a 100644 (file)
@@ -136,6 +136,21 @@ class ApplicationController < ActionController::Base
     export_from_provider(url)
   end
   
+    rescue_from Pettanr::NotWork, :with => :render_not_work
+    def render_not_work(exception = nil)
+      if exception
+        logger.info "Rendering , :: #{exception.message}"
+      end
+      respond_to do |format|
+        format.html { 
+          render :file => "#{Rails.root}/public/not_work.html", :layout => false
+        }
+        format.json { 
+          render :text => "400 Not work", :status => 400
+        }
+      end
+    end
+    
   if Rails.env == 'production'
     rescue_from ActiveRecord::RecordNotFound, :with => :render_404
     rescue_from ActiveRecord::Forbidden, :with => :render_403