Class: Decidim::Demographics::Admin::UpdateDemographicsSettings
- Defined in:
- decidim-demographics/app/commands/decidim/demographics/admin/update_demographics_settings.rb
Instance Attribute Summary collapse
-
#form ⇒ Object
readonly
Returns the value of attribute form.
Instance Method Summary collapse
-
#call ⇒ Object
Updates the demographic data if valid.
-
#initialize(form) ⇒ UpdateDemographicsSettings
constructor
Initializes an UpdateDemographicsSettings Command.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form) ⇒ UpdateDemographicsSettings
Initializes an UpdateDemographicsSettings Command.
10 11 12 |
# File 'decidim-demographics/app/commands/decidim/demographics/admin/update_demographics_settings.rb', line 10 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 Attribute Details
#form ⇒ Object (readonly)
Returns the value of attribute form.
14 15 16 |
# File 'decidim-demographics/app/commands/decidim/demographics/admin/update_demographics_settings.rb', line 14 def form @form end |
Instance Method Details
#call ⇒ Object
Updates the demographic data if valid.
Broadcasts :ok if successful, :invalid otherwise.
22 23 24 25 26 27 28 29 30 |
# File 'decidim-demographics/app/commands/decidim/demographics/admin/update_demographics_settings.rb', line 22 def call Decidim.traceability.perform_action!("update", demographic, current_user) do update_demographic_settings end broadcast(:ok) rescue ActiveRecord::RecordInvalid broadcast(:invalid) end |