Class: Decidim::Admin::UpdateAttachment
- Inherits:
-
Command
- Object
- Command
- Decidim::Admin::UpdateAttachment
- Includes:
- Decidim::AttachmentAttributesMethods
- Defined in:
- app/commands/decidim/admin/update_attachment.rb
Overview
A command with all the business logic to update an attachment from a participatory process.
Instance Attribute Summary collapse
-
#attachment ⇒ Object
readonly
Returns the value of attribute attachment.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(attachment, form, user) ⇒ UpdateAttachment
constructor
Public: Initializes the command.
Constructor Details
#initialize(attachment, form, user) ⇒ UpdateAttachment
Public: Initializes the command.
attachment - the Attachment to update form - A form object with the params.
16 17 18 19 20 |
# File 'app/commands/decidim/admin/update_attachment.rb', line 16 def initialize(, form, user) @attachment = @form = form @user = user end |
Instance Attribute Details
#attachment ⇒ Object (readonly)
Returns the value of attribute attachment.
10 11 12 |
# File 'app/commands/decidim/admin/update_attachment.rb', line 10 def @attachment 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.
28 29 30 31 32 33 |
# File 'app/commands/decidim/admin/update_attachment.rb', line 28 def call return broadcast(:invalid) if form.invalid? broadcast(:ok) end |