Class: Decidim::Budgets::Admin::UpdateProject
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Budgets::Admin::UpdateProject
- Defined in:
- app/commands/decidim/budgets/admin/update_project.rb
Overview
This command is executed when the user changes a Project from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Updates the project if valid.
-
#initialize(form, project) ⇒ UpdateProject
constructor
Initializes an UpdateProject Command.
Constructor Details
#initialize(form, project) ⇒ UpdateProject
Initializes an UpdateProject Command.
form - The form from which to get the data. project - The current instance of the project to be updated.
13 14 15 16 |
# File 'app/commands/decidim/budgets/admin/update_project.rb', line 13 def initialize(form, project) @form = form @project = project end |
Instance Method Details
#call ⇒ Object
Updates the project if valid.
Broadcasts :ok if successful, :invalid otherwise.
21 22 23 24 25 26 27 28 29 30 |
# File 'app/commands/decidim/budgets/admin/update_project.rb', line 21 def call return broadcast(:invalid) if form.invalid? transaction do update_project link_proposals end broadcast(:ok) end |