Class: Decidim::Plans::Admin::ExportPlansToBudgets
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Plans::Admin::ExportPlansToBudgets
- Includes:
- RichPresenter
- Defined in:
- app/commands/decidim/plans/admin/export_plans_to_budgets.rb
Overview
A command with all the business logic when an admin exports plans to a single budget component.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form) ⇒ ExportPlansToBudgets
constructor
Public: Initializes the command.
Methods included from RichPresenter
Constructor Details
#initialize(form) ⇒ ExportPlansToBudgets
Public: Initializes the command.
form - A form object with the params.
14 15 16 |
# File 'app/commands/decidim/plans/admin/export_plans_to_budgets.rb', line 14 def initialize(form) @form = form 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.
24 25 26 27 28 |
# File 'app/commands/decidim/plans/admin/export_plans_to_budgets.rb', line 24 def call return broadcast(:invalid) unless @form.valid? broadcast(:ok, create_projects_from_closed_plans) end |