L1g3r Logo           SignalQ Sites: NetAdminTools - Coprolite - SpotBridge - NAW
RoboCoop - AreWeDown - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - FixRambler
Part D - Rails Application Controller
Topic:MCJ Web Presentation   Date: 2010-01-06
Printer Friendly: Print   

spacerspacer
<<  <   >  >>

Subject

I include the common application controller in this file.

# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details
  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password
#rescue_from NameError, :with => :handle_exceptions
#rescue_from ActionView::TemplateError, :with => :cantdoit
#rescue_from NoMethodError, :with => :handle_exceptions
#rescue_from ActiveRecord::Rollback, :with => :handle_exceptions
#rescue_from ActiveRecord::StatementInvalid, :with => :handle_exceptions
#rescue_from ActiveRecord::RecordNotFound, :with => :handle_exceptions
#rescue_from ActionController::UnknownAction, :with => :handle_exceptions
#rescue_from ActiveRecord::RecordNotFound, :with => :handle_exceptions
#rescue_from ActiveRecord::StaleObjectError, :with => :handle_exceptions
#rescue_from ActiveRecord::RecordInvalid, :with => :handle_exceptions
#rescue_from ActiveRecord::RecordNotSaved, :with => :handle_exceptions
#rescue_from ActionController::MethodNotAllowed, :with => :handle_exceptions
#rescue_from ActionController::MethodNotAllowed, :with => :handle_exceptions
#rescue_from ActionController::InvalidAuthenticityToken, :with => :handle_exceptions
def cantdoit
render :text => "
<html>
<body>
Error 404.  The file you are looking for is no longer here.  Try <a href=\"index.html\">here</a>.
</body>
</html>"
end
include Commcont
end


Updates and Comments:
On my GNU/Linux workstation this file is located at /opt/mcjr/app/controllers/application_controller.rb
People:
Places:
Things:
Times: