Sha256: 5e0730e789d3eb94dea619a1af8b8559132ee89ead88773bfee727e84b679631
Contents?: true
Size: 542 Bytes
Versions: 27
Compression:
Stored size: 542 Bytes
Contents
# frozen_string_literal: true module Decidim module Surveys # Command that gets called whenever a component's survey has to be created. It # usually happens as a callback when the component itself is created. class CreateSurvey < Decidim::Command def initialize(component) @component = component end def call @survey = Survey.new(component: @component, questionnaire: Decidim::Forms::Questionnaire.new) @survey.save ? broadcast(:ok) : broadcast(:invalid) end end end end
Version data entries
27 entries across 27 versions & 1 rubygems