Class: Decidim::Admin::UpdateOrganization
- Defined in:
- decidim-admin/app/commands/decidim/admin/update_organization.rb
Overview
A command with all the business logic for updating the current organization.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(organization, form) ⇒ UpdateOrganization
constructor
Public: Initializes the command.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(organization, form) ⇒ UpdateOrganization
Public: Initializes the command.
organization - The Organization that will be updated. form - A form object with the params.
12 13 14 15 |
# File 'decidim-admin/app/commands/decidim/admin/update_organization.rb', line 12 def initialize(organization, form) @organization = organization @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
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if the form was not valid and we could not proceed.
Returns nothing.
23 24 25 26 27 28 29 |
# File 'decidim-admin/app/commands/decidim/admin/update_organization.rb', line 23 def call return broadcast(:invalid) if form.invalid? return broadcast(:ok, @organization) if update_organization broadcast(:invalid) end |