Topic: helper method is ugly
months = 
number.times do |month|
months << link_to(Time.now.months_ago(month).strftime("%B %Y").to_s + "<br />", archive_path+Time.now.months_ago(month).strftime("/%Y/%m"))
Then I call from the view.
<%= last_number_of_months(6) %>
It works, but I really don't like passing the link_to into an array. Maybe that is ok, but it looks terrible to me. Just not sure how to clean it up. Plus I'm doing + "<br />" to get my line returns. I know I'm calling Time.now.months_ago twice in a row as well and that could probably be shortened up. Real thing I'm worried about though is just passing all that cruft into the array. Thanks!
Last edited by gregf (2007-11-21 22:34:26)