Created
April 25, 2022 22:01
-
-
Save pgwillia/d38613112ab444f3fb6f2e4be339a9d6 to your computer and use it in GitHub Desktop.
Empty Collections in Jupiter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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