Sha256: 27e8943b59274fe1bdab674c87bf7e468bf04cd92fe32ae1e99f0b0e6c4e8e3a

Contents?: true

Size: 492 Bytes

Versions: 17

Compression:

Stored size: 492 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 < Rectify::Command
      def initialize(component)
        @component = component
      end

      def call
        @survey = Survey.new(component: @component)

        @survey.save ? broadcast(:ok) : broadcast(:invalid)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
decidim-surveys-0.15.2 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.15.1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.15.0 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.14.4 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.14.3 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.14.2 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.14.1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.13.1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.12.2 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.13.0 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.12.1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.13.0.pre1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.12.0 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.11.2 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.12.0.pre app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.11.1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.11.0.pre1 app/commands/decidim/surveys/create_survey.rb