Sha256: f32776f32baa4646c1bc8eb0aab6eaa93f21294c8e716fc1de464589a61b0fe3
Contents?: true
Size: 586 Bytes
Versions: 2
Compression:
Stored size: 586 Bytes
Contents
class HomeController < ApplicationController def index @months = [] collect_months(@months) append_current_month(@months) end private def collect_months(months) oldest = Item.minimum("date") newest = Item.maximum("date") if oldest and newest m = newest.beginning_of_month while m >= oldest.beginning_of_month months.push m m <<= 1 end end end def append_current_month(months) current = Time.now.to_date.beginning_of_month unless months.include?(current) months.push current end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
yhara-moneyrail-0.0.2 | app/controllers/home_controller.rb |
moneyrail-0.0.2 | app/controllers/home_controller.rb |