Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 8b99df826c3b6cf56a1caaae5f931d50 > files > 517

ruby-actionpack-2.3.4-1mdv2010.0.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActionController::Rescue</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActionController::Rescue</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/action_controller/rescue_rb.html">
                lib/action_controller/rescue.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Actions that fail to perform as expected throw exceptions. These exceptions
can either be rescued for the public view (with a nice user-friendly
explanation) or for the developers view (with tons of debugging
information). The developers view is already implemented by the Action
Controller, but the public view should be tailored to your specific
application.
</p>
<p>
The default behavior for public exceptions is to render a static html file
with the name of the error code thrown. If no such file exists, an empty
response is sent with the correct status code.
</p>
<p>
You can override what constitutes a local request by overriding the <tt><a
href="Rescue.html#M000066">local_request?</a></tt> method in your own
controller. Custom rescue behavior is achieved by overriding the <tt><a
href="Rescue.html#M000064">rescue_action_in_public</a></tt> and <tt><a
href="Rescue.html#M000067">rescue_action_locally</a></tt> methods.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000066">local_request?</a>&nbsp;&nbsp;
      <a href="#M000063">log_error</a>&nbsp;&nbsp;
      <a href="#M000065">render_optional_error_file</a>&nbsp;&nbsp;
      <a href="#M000062">rescue_action</a>&nbsp;&nbsp;
      <a href="#M000064">rescue_action_in_public</a>&nbsp;&nbsp;
      <a href="#M000067">rescue_action_locally</a>&nbsp;&nbsp;
      <a href="#M000068">rescue_action_without_handler</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Module <a href="Rescue/ClassMethods.html" class="link">ActionController::Rescue::ClassMethods</a><br />

    </div>

    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">LOCALHOST</td>
          <td>=</td>
          <td class="context-item-value">'127.0.0.1'.freeze</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_RESCUE_RESPONSE</td>
          <td>=</td>
          <td class="context-item-value">:internal_server_error</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_RESCUE_RESPONSES</td>
          <td>=</td>
          <td class="context-item-value">{       'ActionController::RoutingError'             =&gt; :not_found,       'ActionController::UnknownAction'            =&gt; :not_found,       'ActiveRecord::RecordNotFound'               =&gt; :not_found,       'ActiveRecord::StaleObjectError'             =&gt; :conflict,       'ActiveRecord::RecordInvalid'                =&gt; :unprocessable_entity,       'ActiveRecord::RecordNotSaved'               =&gt; :unprocessable_entity,       'ActionController::MethodNotAllowed'         =&gt; :method_not_allowed,       'ActionController::NotImplemented'           =&gt; :not_implemented,       'ActionController::InvalidAuthenticityToken' =&gt; :unprocessable_entity</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_RESCUE_TEMPLATE</td>
          <td>=</td>
          <td class="context-item-value">'diagnostics'</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_RESCUE_TEMPLATES</td>
          <td>=</td>
          <td class="context-item-value">{       'ActionView::MissingTemplate'       =&gt; 'missing_template',       'ActionController::RoutingError'    =&gt; 'routing_error',       'ActionController::UnknownAction'   =&gt; 'unknown_action',       'ActionView::TemplateError'         =&gt; 'template_error'</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">RESCUES_TEMPLATE_PATH</td>
          <td>=</td>
          <td class="context-item-value">ActionView::Template::EagerPath.new_and_loaded(       File.join(File.dirname(__FILE__), &quot;templates&quot;))</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000066" class="method-detail">
        <a name="M000066"></a>

        <div class="method-heading">
          <a href="Rescue.src/M000066.html" target="Code" class="method-signature"
            onclick="popupCode('Rescue.src/M000066.html');return false;">
          <span class="method-name">local_request?</span><span class="method-args">(</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
True if the request came from localhost, 127.0.0.1. Override this method if
you wish to redefine the meaning of a local request to include remote IP
addresses or other criteria.
</p>
        </div>
      </div>

      <div id="method-M000063" class="method-detail">
        <a name="M000063"></a>

        <div class="method-heading">
          <a href="Rescue.src/M000063.html" target="Code" class="method-signature"
            onclick="popupCode('Rescue.src/M000063.html');return false;">
          <span class="method-name">log_error</span><span class="method-args">(exception)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Overwrite to implement custom logging of errors. By default logs as fatal.
</p>
        </div>
      </div>

      <div id="method-M000065" class="method-detail">
        <a name="M000065"></a>

        <div class="method-heading">
          <a href="Rescue.src/M000065.html" target="Code" class="method-signature"
            onclick="popupCode('Rescue.src/M000065.html');return false;">
          <span class="method-name">render_optional_error_file</span><span class="method-args">(status_code)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Attempts to render a static error page based on the <tt>status_code</tt>
thrown, or just return headers if no such file exists. At first, it will
try to render a localized static page. For example, if a 500 error is being
handled Rails and locale is :da, it will first attempt to render the file
at <tt>public/500.da.html</tt> then attempt to render
<tt>public/500.html</tt>. If none of them exist, the body of the response
will be left empty.
</p>
        </div>
      </div>

      <div id="method-M000062" class="method-detail">
        <a name="M000062"></a>

        <div class="method-heading">
          <a href="Rescue.src/M000062.html" target="Code" class="method-signature"
            onclick="popupCode('Rescue.src/M000062.html');return false;">
          <span class="method-name">rescue_action</span><span class="method-args">(exception)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Exception handler called when the performance of an action raises an
exception.
</p>
        </div>
      </div>

      <div id="method-M000064" class="method-detail">
        <a name="M000064"></a>

        <div class="method-heading">
          <a href="Rescue.src/M000064.html" target="Code" class="method-signature"
            onclick="popupCode('Rescue.src/M000064.html');return false;">
          <span class="method-name">rescue_action_in_public</span><span class="method-args">(exception)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Overwrite to implement public exception handling (for requests answering
false to <tt><a href="Rescue.html#M000066">local_request?</a></tt>). By
default will call <a
href="Rescue.html#M000065">render_optional_error_file</a>. Override this
method to provide more user friendly error messages.
</p>
        </div>
      </div>

      <div id="method-M000067" class="method-detail">
        <a name="M000067"></a>

        <div class="method-heading">
          <a href="Rescue.src/M000067.html" target="Code" class="method-signature"
            onclick="popupCode('Rescue.src/M000067.html');return false;">
          <span class="method-name">rescue_action_locally</span><span class="method-args">(exception)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Render detailed diagnostics for unhandled exceptions rescued from a
controller action.
</p>
        </div>
      </div>

      <div id="method-M000068" class="method-detail">
        <a name="M000068"></a>

        <div class="method-heading">
          <a href="Rescue.src/M000068.html" target="Code" class="method-signature"
            onclick="popupCode('Rescue.src/M000068.html');return false;">
          <span class="method-name">rescue_action_without_handler</span><span class="method-args">(exception)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>