title: Fill array with nils for when nothing returned from query in ruby (RoR)
body: <p>I have a model called foo with a date field.</p>
  
  <p>On my index view, I am showing a typical "weekly view" for a specified week. To put the data in my view, I loop through each day of the specified week and query the data one day at time. I do this so that I can make sure to put a NIL on the correct day.</p>
  
  <p>foos_controller.rb</p>
  
  <pre><code>for day in 0..6
      foo = Foo.this_date(@date+day.days).first
      @foos[day] = foo
  end
  </code></pre>
  
  <p>index.html.haml</p>
  
  <pre><code>- for day in 0..6
      %li
          - if @foos[day].nil?
              Create a new foo?
          - else
              Display a foo information here
  </code></pre>
  
  <p>Obviously, there's a lot of things wrong here.</p>
  
  <ol>
  <li>I should find someone smart member to tell me how to write a good query so that I only have to do it once.</li>
  <li>I should not have any if/else in my view</li>
  </ol>
  
  <p>My goal here is to either show the content if the it is there for a particular day or show a "create new" link if not.</p>
  
  <p>thanks for the help in advance!!</p>