Class: Decidim::Notify::Admin::CreateChapter
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Notify::Admin::CreateChapter
- Defined in:
- app/commands/decidim/notify/admin/create_chapter.rb
Instance Attribute Summary collapse
-
#form ⇒ Object
readonly
Returns the value of attribute form.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form) ⇒ CreateChapter
constructor
Public: Initializes the command.
Constructor Details
#initialize(form) ⇒ CreateChapter
Public: Initializes the command.
form - A chapter form
10 11 12 |
# File 'app/commands/decidim/notify/admin/create_chapter.rb', line 10 def initialize(form) @form = form end |
Instance Attribute Details
#form ⇒ Object (readonly)
Returns the value of attribute form.
29 30 31 |
# File 'app/commands/decidim/notify/admin/create_chapter.rb', line 29 def form @form end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if we couldn’t proceed.
Returns nothing.
20 21 22 23 24 25 26 27 |
# File 'app/commands/decidim/notify/admin/create_chapter.rb', line 20 def call return broadcast(:invalid) if form.invalid? unset_actives create_chapter! broadcast(:ok, @chapter) end |