Class: Decidim::Elections::Admin::UpdateTrusteeParticipatorySpace
- Inherits:
-
Command
- Object
- Command
- Decidim::Elections::Admin::UpdateTrusteeParticipatorySpace
- Defined in:
- app/commands/decidim/elections/admin/update_trustee_participatory_space.rb
Overview
This command is executed when the user updates a trustee status from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Toggle the considered attr if valid.
-
#initialize(trustee_participatory_space) ⇒ UpdateTrusteeParticipatorySpace
constructor
Public: Initializes the command.
Constructor Details
#initialize(trustee_participatory_space) ⇒ UpdateTrusteeParticipatorySpace
Public: Initializes the command.
trustee_participatory_space - A trustee_participatory_space
12 13 14 |
# File 'app/commands/decidim/elections/admin/update_trustee_participatory_space.rb', line 12 def initialize(trustee_participatory_space) @trustee_participatory_space = trustee_participatory_space end |
Instance Method Details
#call ⇒ Object
Toggle the considered attr if valid.
Broadcasts :ok if successful, :invalid otherwise.
19 20 21 22 23 24 25 |
# File 'app/commands/decidim/elections/admin/update_trustee_participatory_space.rb', line 19 def call return broadcast(:invalid) unless trustee_participatory_space update_trustee_participatory_space! broadcast(:ok, trustee_participatory_space.trustee) end |