Class: Decidim::Plans::Admin::UpdateTag
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Plans::Admin::UpdateTag
- Defined in:
- app/commands/decidim/plans/admin/update_tag.rb
Overview
A command with all the business logic when a user updates a tag.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, tag) ⇒ UpdateTag
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, tag) ⇒ UpdateTag
Public: Initializes the command.
form - A form object with the params. tag - The target object to be updated.
12 13 14 15 |
# File 'app/commands/decidim/plans/admin/update_tag.rb', line 12 def initialize(form, tag) @form = form @tag = tag end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid, together with the plan.
-
:invalid if the form wasn’t valid and we couldn’t proceed.
Returns nothing.
23 24 25 26 27 28 29 |
# File 'app/commands/decidim/plans/admin/update_tag.rb', line 23 def call return broadcast(:invalid) if form.invalid? update_tag broadcast(:ok, tag) end |