title: How does Rails ActiveRecord chain "where" clauses without multiple queries?
body: <p>I'm a PHP developer learning the awesomness of Ruby on Rails, I'm loving ActiveRecord and i noticed something really interesting, Which is how ActiveRecord methods detect the end of method chain to execute the query.</p>
  
  <pre><code>@person = Person.where(name: 'Jason').where(age: 26)
  
  # In my humble imagination I'd think that each where() executes a database query
  # But in reality, it doesn't until the last method in the chain
  </code></pre>
  
  <p>How does this sorcery work?</p>