Sha256: 404864e3c2a582b0545ac806a1297fbaa8b024ba8c062b90b2de7a4864b4b8a9
Contents?: true
Size: 981 Bytes
Versions: 82
Compression:
Stored size: 981 Bytes
Contents
# frozen_string_literal: true module Decidim module Accountability module Admin # This command is executed when the user creates a TimelineEntry # for a Result from the admin panel. class CreateTimelineEntry < Rectify::Command def initialize(form) @form = form end # Creates the timeline_entry if valid. # # Broadcasts :ok if successful, :invalid otherwise. def call return broadcast(:invalid) if @form.invalid? transaction do create_timeline_entry end broadcast(:ok) end private attr_reader :timeline_entry def create_timeline_entry @timeline_entry = TimelineEntry.create!( decidim_accountability_result_id: @form.decidim_accountability_result_id, entry_date: @form.entry_date, description: @form.description ) end end end end end
Version data entries
82 entries across 82 versions & 1 rubygems