Skip to content

Instantly share code, notes, and snippets.

@ahoward ahoward/-
Created Feb 26, 2018

Embed
What would you like to do?
=begin
1) save this file in the rails_root as 'a.rb'
2) run
~> ./bin/rails runner a.rb
3) it should print out something like
DESTROY: Audience[account: "control-group", name: "sample", id: 5a87337cbfe1a449740024db]
ORPHAN: Audience[account: "wiland", name: "SpotRight Testing (lrcawarriors)", id: 5a036a72bfe1a4b843000673]
ORPHAN: Audience[account: "wiland", name: "SpotRight Testing (lrcawarriors)", id: 5a038d67bfe1a4e6c700003f]
ORPHAN: Audience[account: "control-group", name: "sample", id: 5a87337cbfe1a449740024db]
=end
show = proc do |a|
"#{ a.class.name }[account: #{ a.account.slug.inspect }, name: #{ a.name.inspect }, id: #{ a.id }]"
end
audience = Audience.where(:id => '5a87337cbfe1a449740024db').first
audience.destroy
puts "DESTROY: #{ show[audience] }"
puts
Audience.all.each do |doc|
if doc.analysis.blank?
puts "ORPHAN: #{ show[doc] }"
end
end
Audience::Distribution.all.each do |doc|
if doc.analysis.blank?
puts "ORPHAN: #{ show[doc] }"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.