<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:refactormycode.com,2007:users197</id>
  <link type="application/atom+xml" href="http://refactormycode.com/users/197" rel="self"/>
  <title>netzdamon.myopenid.com</title>
  <updated>Sun Jan 20 23:51:41 +0000 2008</updated>
  <entry>
    <id>tag:refactormycode.com,2007:Refactor1667</id>
    <published>2008-01-20T23:51:41+00:00</published>
    <title>[Ruby] On last_number_of_months</title>
    <content type="html">&lt;p&gt;Had to do with not renaming time to what you now named months_ago. Thanks for the help.&lt;/p&gt;

&lt;pre&gt;&lt;/pre&gt;</content>
    <author>
      <name>netzdamon.myopenid.com</name>
      <email>netzdamon@gmail.com</email>
    </author>
    <link type="text/html" href="http://refactormycode.com/codes/216-last_number_of_months/refactors/1667" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:refactormycode.com,2007:Refactor1662</id>
    <published>2008-01-20T19:26:25+00:00</published>
    <title>[Ruby] On last_number_of_months</title>
    <content type="html">&lt;p&gt;Was a couple issues with the code above I fixed to work with my setup. Weird is though is the link_to links to the right url lets say 2008/01 but the :visual will display December 2007 for that. So you end up with a something like this.&lt;/p&gt;

&lt;p&gt;&amp;lt;a href=&amp;quot;&lt;a href="http://localhost:3000/2008/01" target="_blank"&gt;http://localhost:3000/2008/01&lt;/a&gt;&amp;quot;&amp;gt;December 2007&amp;lt;/a&amp;gt;&lt;/p&gt;

&lt;p&gt;What would be causing that? Happens with or without my modifications to your above code.&lt;/p&gt;

&lt;pre&gt;&lt;/pre&gt;</content>
    <author>
      <name>netzdamon.myopenid.com</name>
      <email>netzdamon@gmail.com</email>
    </author>
    <link type="text/html" href="http://refactormycode.com/codes/216-last_number_of_months/refactors/1662" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:refactormycode.com,2007:Refactor1660</id>
    <published>2008-01-20T18:27:01+00:00</published>
    <title>[Ruby] On last_number_of_months</title>
    <content type="html">&lt;p&gt;Thanks for the great response. I was already doing the map.posts for my archive section. I was not thinking I could easily reuse what I have to get rid of that section of code. Thanks for clearing things up.&lt;/p&gt;

&lt;pre&gt;&lt;/pre&gt;</content>
    <author>
      <name>netzdamon.myopenid.com</name>
      <email>netzdamon@gmail.com</email>
    </author>
    <link type="text/html" href="http://refactormycode.com/codes/216-last_number_of_months/refactors/1660" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:refactormycode.com,2007:Code216</id>
    <published>2008-01-20T14:13:05+00:00</published>
    <updated>2008-01-22T11:51:53+00:00</updated>
    <title>[Ruby] last_number_of_months</title>
    <content type="html">&lt;p&gt;Just wrote my first rails application, and now I'm trying to go back and refactor parts of it. This piece is really bothering me. Just not sure what I can do with it.&lt;/p&gt;

&lt;p&gt;Pay no attention to the bad function names. :P&lt;/p&gt;

&lt;pre&gt;module ApplicationHelper
  def time_month(month)
    return Time.now.months_ago(month)
  end

  def last_number_of_months(number)
    months = []
    number.times do |month|
      months &amp;lt;&amp;lt; link_to(time_month(month).strftime(&amp;quot;%B %Y&amp;quot;),
                        #posts_path +
                        time_month(month).strftime(&amp;quot;/%Y/%m&amp;quot;))
      end
    return months.join(&amp;quot;&amp;lt;br /&amp;gt;&amp;quot;)
  end
end&lt;/pre&gt;</content>
    <author>
      <name>netzdamon.myopenid.com</name>
      <email>netzdamon@gmail.com</email>
    </author>
    <link type="text/html" href="http://refactormycode.com/codes/216-last_number_of_months" rel="alternate"/>
  </entry>
</feed>
