Class: Decidim::NavigationMaps::SaveArea
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::NavigationMaps::SaveArea
- Defined in:
- app/commands/decidim/navigation_maps/save_area.rb
Overview
This command creates or updates areas for a blueprints
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form) ⇒ SaveArea
constructor
Creates or updates an area for a blueprint.
Constructor Details
#initialize(form) ⇒ SaveArea
Creates or updates an area for a blueprint.
form - The form with the data.
10 11 12 |
# File 'app/commands/decidim/navigation_maps/save_area.rb', line 10 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.
20 21 22 23 24 25 26 27 28 |
# File 'app/commands/decidim/navigation_maps/save_area.rb', line 20 def call return broadcast(:invalid, form.errors..join(", ")) if form.invalid? initialize_area update_area save_area! broadcast(:ok, @area) end |