Class: Decidim::UpdateAccount
- Defined in:
 - app/commands/decidim/update_account.rb
 
Overview
This command updates the user’s account.
Instance Method Summary collapse
- #call ⇒ Object
 - 
  
    
      #initialize(form)  ⇒ UpdateAccount 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Updates a user’s account.
 
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form) ⇒ UpdateAccount
Updates a user’s account.
form - The form with the data.
      11 12 13  | 
    
      # File 'app/commands/decidim/update_account.rb', line 11 def initialize(form) @form = form end  | 
  
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
      15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  | 
    
      # File 'app/commands/decidim/update_account.rb', line 15 def call return broadcast(:invalid, @form.password) unless @form.valid? update_personal_data update_avatar update_password if current_user.valid? changes = current_user.changed current_user.save! notify_followers send_update_summary!(changes) broadcast(:ok, current_user.unconfirmed_email.present?) else [:avatar, :password].each do |key| @form.errors.add key, current_user.errors[key] if current_user.errors.has_key? key end broadcast(:invalid, @form.password) end end  |