Sha256: 56f733482c1ca16d2937a3ea699a7ec6dac81931430a3929776f71e8b464d5ac
Contents?: true
Size: 850 Bytes
Versions: 17
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # A command with all the business logic when creating a static scope. class CreateScope < Rectify::Command # Public: Initializes the command. # # form - A form object with the params. def initialize(form) @form = form end # 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. def call return broadcast(:invalid) if form.invalid? create_scope broadcast(:ok) end private attr_reader :form def create_scope Scope.create!( name: form.name, organization: form.organization ) end end end end
Version data entries
17 entries across 17 versions & 2 rubygems