Sha256: 05f202ef5f2ebe34c1555219f73f0655b8a1145938d6fa18e677f3d147b4d772
Contents?: true
Size: 919 Bytes
Versions: 19
Compression:
Stored size: 919 Bytes
Contents
# frozen_string_literal: true module Decidim module Accountability module Admin # This command is executed when the user creates a Status from the admin # panel. class CreateStatus < Rectify::Command def initialize(form) @form = form end # Creates the status if valid. # # Broadcasts :ok if successful, :invalid otherwise. def call return broadcast(:invalid) if @form.invalid? transaction do create_status end broadcast(:ok) end private attr_reader :status def create_status @status = Status.create!( feature: @form.current_feature, key: @form.key, name: @form.name, description: @form.description, progress: @form.progress ) end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems