Sha256: 6bb653501f57a2fb1341c4cc2805d418cc4473b7df1382b0f9903a801b426d3a
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
# frozen_string_literal: true module Decidim module ActionDelegator module Admin class UpdatePonderation < Decidim::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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-action_delegator-0.8.1 | app/commands/decidim/action_delegator/admin/update_ponderation.rb |