Files
growstuff/doc/User.html
2012-09-03 12:43:11 +01:00

238 lines
7.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>class User - RDoc Documentation</title>
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
<script type="text/javascript">
var rdoc_rel_prefix = "./";
</script>
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
<body id="top" class="class">
<nav id="metadata">
<nav id="home-section" class="section">
<h3 class="section-header">
<a href="./index.html">Home</a>
<a href="./table_of_contents.html#classes">Classes</a>
<a href="./table_of_contents.html#methods">Methods</a>
</h3>
</nav>
<nav id="search-section" class="section project-section" class="initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<h3 class="section-header">
<input type="text" name="search" placeholder="Search" id="search-field"
title="Type to search, Up and Down to navigate, Enter to load">
</h3>
</form>
<ul id="search-results" class="initially-hidden"></ul>
</nav>
<div id="file-metadata">
<nav id="file-list-section" class="section">
<h3 class="section-header">Defined In</h3>
<ul>
<li>app/models/user.rb
</ul>
</nav>
</div>
<div id="class-metadata">
<nav id="parent-class-section" class="section">
<h3 class="section-header">Parent</h3>
<p class="link">ActiveRecord::Base
</nav>
<!-- Method Quickref -->
<nav id="method-list-section" class="section">
<h3 class="section-header">Methods</h3>
<ul class="link-list">
<li><a href="#method-c-find_first_by_auth_conditions">::find_first_by_auth_conditions</a>
</ul>
</nav>
</div>
<div id="project-metadata">
<nav id="fileindex-section" class="section project-section">
<h3 class="section-header">Pages</h3>
<ul>
<li class="file"><a href="./Gemfile.html">Gemfile</a>
<li class="file"><a href="./LICENSE_txt.html">LICENSE</a>
<li class="file"><a href="./Rakefile.html">Rakefile</a>
<li class="file"><a href="./public/robots_txt.html">robots</a>
</ul>
</nav>
<nav id="classindex-section" class="section project-section">
<h3 class="section-header">Class and Module Index</h3>
<ul class="link-list">
<li><a href="./ActiveSupport.html">ActiveSupport</a>
<li><a href="./ActiveSupport/TestCase.html">ActiveSupport::TestCase</a>
<li><a href="./ActiveSupport/TestCase/ActionController.html">ActiveSupport::TestCase::ActionController</a>
<li><a href="./ActiveSupport/TestCase/ActionController/TestCase.html">ActiveSupport::TestCase::ActionController::TestCase</a>
<li><a href="./Growstuff.html">Growstuff</a>
<li><a href="./Growstuff/Application.html">Growstuff::Application</a>
<li><a href="./AddUsernameToUsers.html">AddUsernameToUsers</a>
<li><a href="./ApplicationController.html">ApplicationController</a>
<li><a href="./ApplicationHelper.html">ApplicationHelper</a>
<li><a href="./BrowsingTest.html">BrowsingTest</a>
<li><a href="./DeviseCreateUsers.html">DeviseCreateUsers</a>
<li><a href="./HomeController.html">HomeController</a>
<li><a href="./HomeControllerTest.html">HomeControllerTest</a>
<li><a href="./HomeHelper.html">HomeHelper</a>
<li><a href="./HomeHelperTest.html">HomeHelperTest</a>
<li><a href="./Object.html">Object</a>
<li><a href="./User.html">User</a>
<li><a href="./UserTest.html">UserTest</a>
</ul>
</nav>
</div>
</nav>
<div id="documentation">
<h1 class="class">class User</h1>
<div id="description" class="description">
</div><!-- description -->
<section id="5Buntitled-5D" class="documentation-section">
<!-- Attributes -->
<section id="attribute-method-details" class="method-section section">
<h3 class="section-header">Attributes</h3>
<div id="attribute-i-login" class="method-detail">
<div class="method-heading attribute-method-heading">
<span class="method-name">login</span><span
class="attribute-access-type">[RW]</span>
</div>
<div class="method-description">
<p>Virtual attribute for authenticating by either username or email This is in
addition to a real persisted field like username</p>
</div>
</div>
</section><!-- attribute-method-details -->
<!-- Methods -->
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
<h3 class="section-header">Public Class Methods</h3>
<div id="method-c-find_first_by_auth_conditions" class="method-detail ">
<div class="method-heading">
<span class="method-name">find_first_by_auth_conditions</span><span
class="method-args">(warden_conditions)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>allow login via either username or email address</p>
<div class="method-source-code" id="find_first_by_auth_conditions-source">
<pre><span class="ruby-comment"># File app/models/user.rb, line 18</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">find_first_by_auth_conditions</span>(<span class="ruby-identifier">warden_conditions</span>)
<span class="ruby-identifier">conditions</span> = <span class="ruby-identifier">warden_conditions</span>.<span class="ruby-identifier">dup</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">login</span> = <span class="ruby-identifier">conditions</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:login</span>)
<span class="ruby-identifier">where</span>(<span class="ruby-identifier">conditions</span>).<span class="ruby-identifier">where</span>([<span class="ruby-string">&quot;lower(username) = :value OR lower(email) = :value&quot;</span>, { <span class="ruby-value">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">login</span>.<span class="ruby-identifier">downcase</span> }]).<span class="ruby-identifier">first</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">where</span>(<span class="ruby-identifier">conditions</span>).<span class="ruby-identifier">first</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- find_first_by_auth_conditions-source -->
</div>
</div><!-- find_first_by_auth_conditions-method -->
</section><!-- public-class-method-details -->
</section><!-- 5Buntitled-5D -->
</div><!-- documentation -->
<footer id="validator-badges">
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>