Sha256: 0ef2274441f92dd99394742e0210cef4a2bc0f16a728b7b6c4ae70bc42bc97d3
Contents?: true
Size: 740 Bytes
Versions: 54
Compression:
Stored size: 740 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # Creates a newsletter and assigns the right author and # organization. class CreateNewsletter < Rectify::Command # Initializes the command. # # form - The source fo data for this newsletter. # user - The User that authored this newsletter. def initialize(form, user) @form = form @user = user end def call return broadcast(:invalid) unless @form.valid? newsletter = Newsletter.create!( subject: @form.subject, body: @form.body, author: @user, organization: @user.organization ) broadcast(:ok, newsletter) end end end end
Version data entries
54 entries across 54 versions & 2 rubygems