Class: Decidim::Notify::Admin::UpdateChapter
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Notify::Admin::UpdateChapter
- Defined in:
- app/commands/decidim/notify/admin/update_chapter.rb
Instance Attribute Summary collapse
-
#chapter ⇒ Object
readonly
Returns the value of attribute chapter.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, chapter) ⇒ UpdateChapter
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, chapter) ⇒ UpdateChapter
Public: Initializes the command.
form - A chapter form chapter - the chapter to be update
11 12 13 14 |
# File 'app/commands/decidim/notify/admin/update_chapter.rb', line 11 def initialize(form, chapter) @form = form @chapter = chapter end |
Instance Attribute Details
#chapter ⇒ Object (readonly)
Returns the value of attribute chapter.
31 32 33 |
# File 'app/commands/decidim/notify/admin/update_chapter.rb', line 31 def chapter @chapter end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
31 32 33 |
# File 'app/commands/decidim/notify/admin/update_chapter.rb', line 31 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.
22 23 24 25 26 27 28 29 |
# File 'app/commands/decidim/notify/admin/update_chapter.rb', line 22 def call return broadcast(:invalid) if form.invalid? unset_actives update_chapter! broadcast(:ok) end |