title: Selecting distinct dates for a blog archive
body: <p>I'm using Rails for a blog engine. I'm implementing an archive feature that archives based on unique month and years where a post has been published.</p>
  
  <p>Here's the cucumber feature:</p>
  
  <pre><code>  Scenario: Displaying an archive menu from distinct posts months and years 
     Given the following posts exists for the blog "Blondinbella":
           | Title           | Published at          |
           | Redbull         | 1 March 2010 11:00    |
           | Tuesday outfit  | 2 January 2010 11:00  |
           | Monday outfit   | 1 January 2010 11:00  |
           | Another outfit  | 1 December 2009 11:00 |
      When I visit the blog "Blondinbella"
      Then I should see "March 2010" in the archive menu
       And I should see "January 2010" in the archive menu
       And I should see "December 2009" in the archive menu
       But I should not see "February 2010" in the archive menu
  </code></pre>
  
  <p>I am having a hard time figuring out the best approach for this. Should I go hardcore with a SQL-query and if so how would that look? (Using PostgreSQL)</p>
  
  <p>Or is there a way of doing this smoothly just using pure Rails?</p>