I need a method that generates an array containing the month end date for each of the past 12 months. I've come up with the solution below. It works, however, there's probably a more elegant way to solve this problem. Any suggestions? Is there a more efficient way to generate this array? Any advice would be greatly appreciated.

```
require 'active_support/time'

...

def months
  last_month_end = (Date.today - 1.month).end_of_month
  months = [last_month_end]
  11.times do
    month_end = (last_month_end - 1.month).end_of_month
    months << month_end
  end
  months
end

```