Skip to content

Instantly share code, notes, and snippets.

@pgwillia
Created April 25, 2022 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgwillia/d38613112ab444f3fb6f2e4be339a9d6 to your computer and use it in GitHub Desktop.
Save pgwillia/d38613112ab444f3fb6f2e4be339a9d6 to your computer and use it in GitHub Desktop.
Empty Collections in Jupiter
empty_collections = Collection.find_each.filter {|collection| collection.member_objects.size == 0 }
CSV.open('empty_collections.csv', 'wb') do |csv|
csv << ['Community', 'Collection', 'url']
empty_collections.each do |collection|
community_title = Community.find(collection.community_id)
url = Rails.application.routes.url_helpers.community_collection_url(collection.community_id, collection.id)
csv << [community_title, collection.title, url]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment