Skip to content

Instantly share code, notes, and snippets.

@ccarruitero
Created May 29, 2014 04:07
Show Gist options
  • Save ccarruitero/97f8f1911dad9d734e3c to your computer and use it in GitHub Desktop.
Save ccarruitero/97f8f1911dad9d734e3c to your computer and use it in GitHub Desktop.
likes = FBLike.uniq.pluck(:name)
require "csv"
CSV.open("file.csv", "wb") do |csv|
csv << ["like_page", "counts"]
likes.each do |like|
like_counts = User.includes(:fb_likes).where(fb_likes: {name: like}).count
csv << [like, like_counts]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment