Sha256: fb3db98392de60cfc427ea2188ee74f721005a69a01367948626dbe547c898a1
Contents?: true
Size: 1000 Bytes
Versions: 65
Compression:
Stored size: 1000 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # A command with all the business logic when updating a scope type. class UpdateScopeType < Rectify::Command # Public: Initializes the command. # # scope_type - The ScopeType to update # form - A form object with the params. def initialize(scope_type, form) @scope_type = scope_type @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? update_scope_type broadcast(:ok) end private attr_reader :form def update_scope_type @scope_type.update!(attributes) end def attributes { name: form.name, plural: form.plural } end end end end
Version data entries
65 entries across 65 versions & 1 rubygems