2019/02/14

Agrupar objetos por fecha de creacion

accounts.each do |account| by_years = Tweet.where(screen_name: account).group_by {|u| u.twt_created_at_date.year } by_years.keys.sort.each do |year| by_months = by_years[year].group_by {|u| u.twt_created_at_date.month } by_months.keys.sort.each do |month| #DO SOMETHING end end end

No hay comentarios: