Class: Decidim::Admin::CreateNewsletter
- Defined in:
- decidim-admin/app/commands/decidim/admin/create_newsletter.rb
Overview
Creates a newsletter and assigns the right author and organization.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(form, content_block, user) ⇒ CreateNewsletter
constructor
Initializes the command.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form, content_block, user) ⇒ CreateNewsletter
Initializes the command.
form - The source fo data for this newsletter. content_block - An instance of ‘Decidim::ContentBlock` that holds the
newsletter attributes.
user - The User that authored this newsletter.
14 15 16 17 18 |
# File 'decidim-admin/app/commands/decidim/admin/create_newsletter.rb', line 14 def initialize(form, content_block, user) @form = form @content_block = content_block @user = user end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'decidim-admin/app/commands/decidim/admin/create_newsletter.rb', line 20 def call return broadcast(:invalid) unless form.valid? transaction do create_content_block end broadcast(:ok, ) end |