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