Sha256: b354235655528c57a7cf38f70780a73d61488f85d60899c8244e5cdcf8df017a
Contents?: true
Size: 970 Bytes
Versions: 3
Compression:
Stored size: 970 Bytes
Contents
# frozen_string_literal: true module Decidim module ActionDelegator module Admin class UpdatePonderation < Rectify::Command # Public: Initializes the command. # # form - A form object with the params. def initialize(form, ponderation) @form = form @ponderation = ponderation 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_ponderation broadcast(:ok, ponderation) end private attr_reader :form, :ponderation def update_ponderation ponderation.name = form.name ponderation.weight = form.weight ponderation.save! end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems