Sha256: f498b60d8d8ab9773f0bb19366d25cb4adb2a3e8516d89b664583bb82ee6d92f
Contents?: true
Size: 851 Bytes
Versions: 18
Compression:
Stored size: 851 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
18 entries across 18 versions & 2 rubygems