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.10.1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.10.0 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.9.3 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.9.2 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.9.1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.9.0 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.8.4 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.8.3 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.8.2 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.8.1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.8.0 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.7.4 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.7.3 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.7.2 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.7.1 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.7.0 app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.6.8 app/commands/decidim/surveys/create_survey.rb
decidim-0.6.8 decidim-surveys/app/commands/decidim/surveys/create_survey.rb
decidim-surveys-0.6.7 app/commands/decidim/surveys/create_survey.rb
decidim-0.6.7 decidim-surveys/app/commands/decidim/surveys/create_survey.rb