Class: Decidim::Kids::MinorAccount

Inherits:
ApplicationRecord show all
Defined in:
app/models/decidim/kids/minor_account.rb

Instance Method Summary collapse

Instance Method Details

#promote_account!Object



19
20
21
22
23
24
25
26
27
# File 'app/models/decidim/kids/minor_account.rb', line 19

def promote_account!
  return if minor.minor_age <= (minor&.organization&.maximum_minor_age || Decidim::Kids.maximum_minor_age)

  ActiveRecord::Base.transaction do
    minor.tutors.destroy_all
    minor.minor_data.destroy
  end
  Decidim::Kids::KidsMailer.(minor).deliver_now
end