title: Independent ActiveRecord query inside ActiveRecord::Relation context
body: <p><br>
  There is some ruby on rails code</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    def self.all_users_count
      User.all
    end
  end
  </code></pre>
  
  <p><code>User.all_users_count</code> <br>
  returns, for example, <strong>100</strong></p>
  
  <p><code>User.limit(5).all_users_count</code> <br>
  Now it return <strong>5</strong> because of ActiveRecord::Relation context, in despite of i wroute name of class <code>User.all</code> instead simple <code>all</code><br>
  (.to_sql show that query always contains <code>limit</code> or <code>where id</code> or other things in other cases)<br></p>
  
  <p>So, how can i make context-independent AR queries inside model methods? like <code>User.all</code> and others?</p>
  
  <p>Thank you!<br></p>
  
  <p>Ps. Or maybe my code has an error or something like this, and in fact <code>User.all</code> inside any methods and context always must returns correct rows count of this model table</p>