OSDN Git Service

add test
[pettanr/pettanr.git] / app / controllers / application_controller.rb
index 2be2325..79a5b24 100644 (file)
@@ -3,7 +3,7 @@ class ApplicationController < ActionController::Base
   before_filter :bf
   
   def bf
-    if Admin.count.to_i == 0
+    if Admin.count.to_i == 0 or License.count.to_i == 0
       if params[:controller] == 'system' and params[:action] == 'start'
       else
         redirect_to :controller => '/system', :action => 'start'
@@ -21,4 +21,22 @@ class ApplicationController < ActionController::Base
     end
   end
   
+=begin
+  rescue_from ActiveRecord::RecordNotFound, :with => :render_404\r
+\r
+  private\r
+  def render_404(exception = nil)\r
+    if exception\r
+        logger.info "Rendering 404: #{exception.message}"\r
+    end\r
+    respond_to do |format|
+          format.html { \r
+    render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false\r
+}
+          format.json { 
+    render :text => "404 found", :status => 404\r
+}
+  end\r
+  end\r
+=end  \r
 end