Class: Decidim::Kids::UpdateMinorAccount
- Inherits:
-
Command
- Object
- Command
- Decidim::Kids::UpdateMinorAccount
- Defined in:
- app/commands/decidim/kids/update_minor_account.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(form, minor_user) ⇒ UpdateMinorAccount
constructor
A new instance of UpdateMinorAccount.
Constructor Details
#initialize(form, minor_user) ⇒ UpdateMinorAccount
Returns a new instance of UpdateMinorAccount.
6 7 8 9 |
# File 'app/commands/decidim/kids/update_minor_account.rb', line 6 def initialize(form, minor_user) @form = form @minor_user = minor_user end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/commands/decidim/kids/update_minor_account.rb', line 11 def call return broadcast(:invalid) if form.invalid? old_minor_email = minor_user.email update_minor minor_user.save! minor_user.minor_data.update!(attributes_data) minor_user.invite!(invited_by, invitation_instructions: "invite_minor") unless old_minor_email == form.email broadcast(:ok) end |