Sha256: 8ed0a142f969d1d177c75cdbe11782e93b19ed9a34c3676e0736d131f0b6f941

Contents?: true

Size: 478 Bytes

Versions: 54

Compression:

Stored size: 478 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Surveys
    # Command that gets called whenever a feature's survey has to be created. It
    # usually happens as a callback when the feature itself is created.
    class CreateSurvey < Rectify::Command
      def initialize(feature)
        @feature = feature
      end

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

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

Version data entries

54 entries across 54 versions & 2 rubygems

Version Path
decidim-surveys-0.4.3 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.4.2 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.4.1 app/commands/decidim/surveys/create_survey.rb
decidim-0.4.3 decidim-surveys/app/commands/decidim/surveys/create_survey.rb
decidim-0.4.2 decidim-surveys/app/commands/decidim/surveys/create_survey.rb
decidim-0.4.1 decidim-surveys/app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.4.0 app/commands/decidim/surveys/create_survey.rb
decidim-0.4.0 decidim-surveys/app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.3.2 app/commands/decidim/surveys/create_survey.rb
decidim-0.3.2 decidim-surveys/app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.3.1 app/commands/decidim/surveys/create_survey.rb
decidim-0.3.1 decidim-surveys/app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.3.0 app/commands/decidim/surveys/create_survey.rb
decidim-0.3.0 decidim-surveys/app/commands/decidim/surveys/create_survey.rb