Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > d51872cc0e1fdee944d71993f94ac764 > files > 683

ruby-activerecord-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: ActiveRecord::Reflection::ClassMethods</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">ActiveRecord::Reflection::ClassMethods</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/lib/active_record/reflection_rb.html">
                lib/active_record/reflection.rb
                </a>
        <br />
            </td>
        </tr>

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

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Reflection allows you to interrogate Active Record classes and objects
about their associations and aggregations. This information can, for
example, be used in a form builder that took an Active Record object and
created input fields for all of the attributes depending on their type and
displayed the associations to other objects.
</p>
<p>
You can find the interface for the AggregateReflection and
AssociationReflection classes in the abstract <a
href="MacroReflection.html">MacroReflection</a> class.
</p>

    </div>


   </div>

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

      <div class="name-list">
      <a href="#M000029">create_reflection</a>&nbsp;&nbsp;
      <a href="#M000032">reflect_on_aggregation</a>&nbsp;&nbsp;
      <a href="#M000031">reflect_on_all_aggregations</a>&nbsp;&nbsp;
      <a href="#M000033">reflect_on_all_associations</a>&nbsp;&nbsp;
      <a href="#M000035">reflect_on_all_autosave_associations</a>&nbsp;&nbsp;
      <a href="#M000034">reflect_on_association</a>&nbsp;&nbsp;
      <a href="#M000030">reflections</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


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

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

        <div class="method-heading">
          <a href="ClassMethods.src/M000029.html" target="Code" class="method-signature"
            onclick="popupCode('ClassMethods.src/M000029.html');return false;">
          <span class="method-name">create_reflection</span><span class="method-args">(macro, name, options, active_record)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

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

        <div class="method-heading">
          <a href="ClassMethods.src/M000032.html" target="Code" class="method-signature"
            onclick="popupCode('ClassMethods.src/M000032.html');return false;">
          <span class="method-name">reflect_on_aggregation</span><span class="method-args">(aggregation)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the AggregateReflection object for the named <tt>aggregation</tt>
(use the symbol). Example:
</p>
<pre>
  Account.reflect_on_aggregation(:balance) # returns the balance AggregateReflection
</pre>
        </div>
      </div>

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

        <div class="method-heading">
          <a href="ClassMethods.src/M000031.html" target="Code" class="method-signature"
            onclick="popupCode('ClassMethods.src/M000031.html');return false;">
          <span class="method-name">reflect_on_all_aggregations</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns an array of AggregateReflection objects for all the aggregations in
the class.
</p>
        </div>
      </div>

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

        <div class="method-heading">
          <a href="ClassMethods.src/M000033.html" target="Code" class="method-signature"
            onclick="popupCode('ClassMethods.src/M000033.html');return false;">
          <span class="method-name">reflect_on_all_associations</span><span class="method-args">(macro = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns an array of AssociationReflection objects for all the associations
in the class. If you only want to reflect on a certain association type,
pass in the symbol (<tt>:has_many</tt>, <tt>:has_one</tt>,
<tt>:belongs_to</tt>) for that as the first parameter. Example:
</p>
<pre>
  Account.reflect_on_all_associations             # returns an array of all associations
  Account.reflect_on_all_associations(:has_many)  # returns an array of all has_many associations
</pre>
        </div>
      </div>

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

        <div class="method-heading">
          <a href="ClassMethods.src/M000035.html" target="Code" class="method-signature"
            onclick="popupCode('ClassMethods.src/M000035.html');return false;">
          <span class="method-name">reflect_on_all_autosave_associations</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns an array of AssociationReflection objects for all associations
which have <tt>:autosave</tt> enabled.
</p>
        </div>
      </div>

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

        <div class="method-heading">
          <a href="ClassMethods.src/M000034.html" target="Code" class="method-signature"
            onclick="popupCode('ClassMethods.src/M000034.html');return false;">
          <span class="method-name">reflect_on_association</span><span class="method-args">(association)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the AssociationReflection object for the named <tt>association</tt>
(use the symbol). Example:
</p>
<pre>
  Account.reflect_on_association(:owner) # returns the owner AssociationReflection
  Invoice.reflect_on_association(:line_items).macro  # returns :has_many
</pre>
        </div>
      </div>

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

        <div class="method-heading">
          <a href="ClassMethods.src/M000030.html" target="Code" class="method-signature"
            onclick="popupCode('ClassMethods.src/M000030.html');return false;">
          <span class="method-name">reflections</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns a hash containing all AssociationReflection objects for the current
class Example:
</p>
<pre>
  Invoice.reflections
  Account.reflections
</pre>
        </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>