Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
283 lines (165 sloc) 8.31 KB
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Module: BelongsToQuery</title>
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
<script src="./js/jquery.js" type="text/javascript"
charset="utf-8"></script>
<script src="./js/thickbox-compressed.js" type="text/javascript"
charset="utf-8"></script>
<script src="./js/quicksearch.js" type="text/javascript"
charset="utf-8"></script>
<script src="./js/darkfish.js" type="text/javascript"
charset="utf-8"></script>
</head>
<body class="module">
<div id="metadata">
<div id="home-metadata">
<div id="home-section" class="section">
<h3 class="section-header">
<a href="./index.html">Home</a>
<a href="./index.html#classes">Classes</a>
<a href="./index.html#methods">Methods</a>
</h3>
</div>
</div>
<div id="file-metadata">
<div id="file-list-section" class="section">
<h3 class="section-header">In Files</h3>
<div class="section-body">
<ul>
<li><a href="./lib/relata/dsl/querys/belongs_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
class="thickbox" title="lib/relata/dsl/querys/belongs.rb">lib/relata/dsl/querys/belongs.rb</a></li>
</ul>
</div>
</div>
</div>
<div id="class-metadata">
<!-- Parent Class -->
<!-- Namespace Contents -->
<!-- Method Quickref -->
<div id="method-list-section" class="section">
<h3 class="section-header">Methods</h3>
<ul class="link-list">
<li><a href="#method-i-add_filter">#add_filter</a></li>
<li><a href="#method-i-query">#query</a></li>
</ul>
</div>
<!-- Included Modules -->
</div>
<div id="project-metadata">
<div id="fileindex-section" class="section project-section">
<h3 class="section-header">Files</h3>
<ul>
<li class="file"><a href="./Gemfile.html">Gemfile</a></li>
<li class="file"><a href="./MIT-LICENSE.html">MIT-LICENSE</a></li>
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
</ul>
</div>
<div id="classindex-section" class="section project-section">
<h3 class="section-header">Class Index
<span class="search-toggle"><img src="./images/find.png"
height="16" width="16" alt="[+]"
title="show/hide quicksearch" /></span></h3>
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
<fieldset>
<legend>Quicksearch</legend>
<input type="text" name="quicksearch" value=""
class="quicksearch-field" />
</fieldset>
</form>
<ul class="link-list">
<li><a href="./Relata.html">Relata</a></li>
<li><a href="./Relata/Dsl.html">Relata::Dsl</a></li>
<li><a href="./Relata/Dsl/Conditions.html">Relata::Dsl::Conditions</a></li>
<li><a href="./Relata/Dsl/Constraints.html">Relata::Dsl::Constraints</a></li>
<li><a href="./Relata/Dsl/Constraints/CountManager.html">Relata::Dsl::Constraints::CountManager</a></li>
<li><a href="./Relata/Dsl/Constraints/LengthManager.html">Relata::Dsl::Constraints::LengthManager</a></li>
<li><a href="./Relata/Dsl/Constraints/RangeManager.html">Relata::Dsl::Constraints::RangeManager</a></li>
<li><a href="./Relata/Dsl/Constraints/SimpleCondition.html">Relata::Dsl::Constraints::SimpleCondition</a></li>
<li><a href="./Relata/Dsl/Constraints/SimpleRangeCondition.html">Relata::Dsl::Constraints::SimpleRangeCondition</a></li>
<li><a href="./Relata/Dsl/CustomRelation.html">Relata::Dsl::CustomRelation</a></li>
<li><a href="./Relata/Dsl/FieldSearch.html">Relata::Dsl::FieldSearch</a></li>
<li><a href="./Relata/Dsl/FieldSearchMany.html">Relata::Dsl::FieldSearchMany</a></li>
<li><a href="./Relata/Dsl/MissedBuilder.html">Relata::Dsl::MissedBuilder</a></li>
<li><a href="./Relata/Dsl/Relation.html">Relata::Dsl::Relation</a></li>
<li><a href="./ActiveRecord.html">ActiveRecord</a></li>
<li><a href="./ActiveRecord/Relation.html">ActiveRecord::Relation</a></li>
<li><a href="./RelatedQueryMethods.html">RelatedQueryMethods</a></li>
<li><a href="./RelatedQueryMethods/ClassMethods.html">RelatedQueryMethods::ClassMethods</a></li>
<li><a href="./BelongsToQuery.html">BelongsToQuery</a></li>
<li><a href="./Comment.html">Comment</a></li>
<li><a href="./DSLTest.html">DSLTest</a></li>
<li><a href="./FilteredRelationTest.html">FilteredRelationTest</a></li>
<li><a href="./ModelFields.html">ModelFields</a></li>
<li><a href="./MultipleQuery.html">MultipleQuery</a></li>
<li><a href="./Object.html">Object</a></li>
<li><a href="./Post.html">Post</a></li>
<li><a href="./Reader.html">Reader</a></li>
<li><a href="./SimpleQuery.html">SimpleQuery</a></li>
<li><a href="./User.html">User</a></li>
</ul>
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
</div>
</div>
</div>
<div id="documentation">
<h1 class="module">BelongsToQuery</h1>
<div id="description">
</div>
<!-- Constants -->
<!-- Attributes -->
<!-- Methods -->
<div id="public-instance-method-details" class="method-section section">
<h3 class="section-header">Public Instance Methods</h3>
<div id="add-filter-method" class="method-detail ">
<a name="method-i-add_filter"></a>
<div class="method-heading">
<span class="method-name">add_filter</span><span
class="method-args">(expectation)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code"
id="add-filter-source">
<pre>
<span class="ruby-comment cmt"># File lib/relata/dsl/querys/belongs.rb, line 5</span>
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_filter</span> <span class="ruby-identifier">expectation</span>
6: <span class="ruby-identifier">query</span>.<span class="ruby-identifier">group</span>(<span class="ruby-ivar">@groups</span>.<span class="ruby-identifier">first</span>).<span class="ruby-identifier">having</span>(<span class="ruby-node">&quot;#{@relation_search} #{expectation}&quot;</span>)
7: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div id="query-method" class="method-detail ">
<a name="method-i-query"></a>
<div class="method-heading">
<span class="method-name">query</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code"
id="query-source">
<pre>
<span class="ruby-comment cmt"># File lib/relata/dsl/querys/belongs.rb, line 2</span>
2: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>
3: <span class="ruby-identifier">preload</span>(<span class="ruby-ivar">@start_field</span>).<span class="ruby-identifier">select</span>(<span class="ruby-ivar">@select_fields</span>.<span class="ruby-identifier">join</span> <span class="ruby-value str">','</span>).<span class="ruby-identifier">from</span>(<span class="ruby-node">&quot;#{table_name}, #{@start_field.to_s.pluralize}&quot;</span>).<span class="ruby-identifier">where</span>(<span class="ruby-node">&quot;#{table_name}.#{@start_field}_id = #{@start_field.to_s.pluralize}.id&quot;</span>)
4: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
<div id="rdoc-debugging-section-dump" class="debugging-section">
<p>Disabled; run with --debug to generate this.</p>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
Rdoc Generator</a> 1.1.6</small>.</p>
</div>
</body>
</html>
Something went wrong with that request. Please try again.