Usually, when you want an array of things to think about map . Although you are on this, why not generalize such a method so that you can return any n months that you wish:
def last_end_dates(count = 12) count.times.map { |i| (Date.today - (i+1).month).end_of_month } end
>> pp last_end_dates(5) [Sun, 30 Jun 2013, Fri, 31 May 2013, Tue, 30 Apr 2013, Sun, 31 Mar 2013, Thu, 28 Feb 2013]
source share