Skip to content

Instantly share code, notes, and snippets.

@thefron
Created January 17, 2014 08:19
Show Gist options
  • Save thefron/8470042 to your computer and use it in GitHub Desktop.
Save thefron/8470042 to your computer and use it in GitHub Desktop.
revelations_by_dates = {}
Revelation.select([:id, :created_at]).find_in_batches(batch_size: 10000) do |revelations|
revelations.each do |revelation|
revelations_by_dates[revelation.created_at.to_date.to_s] ||= 0
revelations_by_dates[revelation.created_at.to_date.to_s] += 1
end
end; nil
revelations_by_dates.sort.each do |date, revelations_count|
puts "#{date}\t#{revelations_count}"
end; nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment