title: What is the real benefit of scopes
body: <p>I've looked at over 10 pages trying to find the benefit of a scope over any other ActiveRecord class method that returns an ActiveRecord::Relation.</p>
  
  <p>In the following for example why are scopes better than the alternative below it which do the same thing:</p>
  
  <pre><code>  #scope :pat1,  lambda {{:conditions =&gt; ["name like ?", 'J%']}}    
    #scope :pat2,  lambda {{:conditions =&gt; ["id  &gt; 5"]}}  
  
    def self.pat1
      where("name like ?", 'J%')
    end  
  
    def self.pat2 
      where("id  &gt; 5")
    end  
  
    def patx 
      self.class.pat1.pat2.first
    end
  </code></pre>
  
  <p>The documentation over and over again says that scopes are beneficial because they can be chained... </p>
  
  <p><em>"All scope methods will return an ActiveRecord::Relation object which will allow for further methods (such as other scopes) to be called on it."</em>
  -<a href="http://guides.rubyonrails.org/active_record_querying.html#scopes" rel="noreferrer">guides.rubyonrails.org</a></p>
  
  <p><em>"The main reason scopes are better than plain class methods is that they can be chained with other methods"</em>
  <a href="http://ruby.railstutorial.org/chapters/following-users?version=3.1#sec:scopes_subselects_and_a_lambda" rel="noreferrer">http://ruby.railstutorial.org</a></p>
  
  <p>...but the alternative above can also be chained producing the same results. </p>
  
  <p>Just trying to figure out if there's an emperor's new clothes thing going on here.  Even from a syntactic standpoint there appears to be no benefit.  Are they faster- some sources  vaguely suggest that. </p>