title: Rails activerecord with all or where
body: <p>I can't see the difference in the ruby console between Model.all and Model.where(:source_id => 2). My problem is with the «all» instruction I can do .each on the array and with Model.where I can't do .each</p>
  
  <p>Working</p>
  
  <pre><code># controller.rb
  @results = Adress.all
  
  #view.haml
  - @results.each do |result|
  </code></pre>
  
  <p>Not-Working</p>
  
  <pre><code># controller.rb
  @results = Adress.where(:source_id =&gt; 2)
  
  #view.haml
  - @results.each do |result|
  </code></pre>
  
  <p>Error message --> undefined method `each' for nil:NilClass</p>
  
  <p>In console    --> Adress.where(:source_id => 2) it's works</p>
  
  <p>------- MY BAD, THE SOLUTION ------</p>
  
  <p>my view was trying to do .each on inexistent variable.......</p>
  
  <p>THE PROBLEM</p>
  
  <pre><code>@Adress = Adress.where(:arrondissement_id =&gt; params[:arrondissement])
  </code></pre>
  
  <p>THE SOLUTION</p>
  
  <pre><code>@results = Adress.where(:arrondissement_id =&gt; params[:arrondissement])
  </code></pre>