Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7260

Show
Ignore:
Timestamp:
08/02/07 18:21:20 (1 year ago)
Author:
minam
Message:

make the exceptions_to_treat_as_404 method a class method, so that it can be appended to easily

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/exception_notification/lib/exception_notifiable.rb

    r6216 r7260  
    4747      end 
    4848    end 
     49 
     50    def exceptions_to_treat_as_404 
     51      exceptions = [ActiveRecord::RecordNotFound, 
     52                    ActionController::UnknownController, 
     53                    ActionController::UnknownAction] 
     54      exceptions << ActionController::RoutingError if ActionController.const_defined?(:RoutingError) 
     55      exceptions 
     56    end 
    4957  end 
    5058 
     
    7280    def rescue_action_in_public(exception) 
    7381      case exception 
    74         when *exceptions_to_treat_as_404 
     82        when *self.class.exceptions_to_treat_as_404 
    7583          render_404 
    7684 
     
    8997      end 
    9098    end 
    91  
    92     def exceptions_to_treat_as_404 
    93       exceptions = [ActiveRecord::RecordNotFound, 
    94                     ActionController::UnknownController, 
    95                     ActionController::UnknownAction] 
    96       exceptions << ActionController::RoutingError if ActionController.const_defined?(:RoutingError) 
    97       exceptions 
    98     end 
    9999end