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