Skip to content

Instantly share code, notes, and snippets.

@mkessler
Created April 22, 2019 18:24
Show Gist options
  • Select an option

  • Save mkessler/04f057b546cc7c51209a764b9d934099 to your computer and use it in GitHub Desktop.

Select an option

Save mkessler/04f057b546cc7c51209a764b9d934099 to your computer and use it in GitHub Desktop.
Hide roster/registrant contact info and age
d = Division.find(DIVISION_ID)
# Hide all roster contact info and age
d.all_controlled_active_rosters.each do |roster|
roster.hide_address = true
roster.hide_age = true
roster.hide_email_address = true
roster.save
roster.roster_telephones.each do |roster_telephone|
roster_telephone.hide = true
roster_telephone.save
end
roster.roster_email_addresses.each do |roster_email_address|
roster_email_address.hide = true
roster_email_address.save
end
roster.contacts.each do |contact|
contact.contact_email_addresses.each do |contact_email_address|
contact_email_address.hide = true
contact_email_address.save
end
contact.contact_telephones.each do |contact_telephone|
contact_telephone.hide = true
contact_telephone.save
end
end
end
# Hide all registrant contact info and age
d.registration_forms.each do |registration_form|
registration_form.registrations.each do |registration|
registration.registrants.each do |registrant|
registrant.hide_address = true
registrant.hide_age = true
registrant.hide_email_address = true
registrant.save
registrant.telephones.each do |telephone|
telephone.hide = true
telephone.save
end
registrant.email_addresses.each do |email_address|
email_address.hide = true
email_address.save
end
registrant.contacts.each do |contact|
contact.contact_email_addresses.each do |contact_email_address|
contact_email_address.hide = true
contact_email_address.save
end
contact.contact_telephones.each do |contact_telephone|
contact_telephone.hide = true
contact_telephone.save
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment