title: what does "class << self" mean in Rails?
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/2505067/class-self-idiom-in-ruby">class &lt;&lt; self idiom in Ruby</a><br>
    <a href="https://stackoverflow.com/questions/4149700/can-someone-please-explain-class-self-to-me">Can someone please explain class &lt;&lt; self to me?</a>  </p>
  </blockquote>
  
  
  
  <p>I would like to know what does <code>class &lt;&lt; self</code> statement mean in a model class? And how does the statement inside it differ from those outside from it. For example:</p>
  
  <pre><code>class Post &lt; ActiveRecord::Base
  
    class &lt;&lt; self
       def search(q)
            # search from DB
       end
    end
     def search2(qq)
           # search from DB
     end
  end
  </code></pre>
  
  <p>What does <code>class &lt;&lt; self</code> mean?</p>
  
  <p>What are the differences between method <code>search(q)</code> and <code>search2(qq)</code> ?</p>