Class: Decidim::Proposals::Import::ProposalAnswerCreator

Inherits:
Admin::Import::Creator
  • Object
show all
Defined in:
lib/decidim/proposals/import/proposal_answer_creator.rb

Overview

This class is responsible for creating the imported proposal answers and must be included in proposals component’s import manifest.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.resource_klassObject

Returns the resource class to be created with the provided data.



10
11
12
# File 'lib/decidim/proposals/import/proposal_answer_creator.rb', line 10

def self.resource_klass
  Decidim::Proposals::Proposal
end

.verifier_klassObject

Returns a verifier class to be used to verify the correctness of the import data.



16
17
18
# File 'lib/decidim/proposals/import/proposal_answer_creator.rb', line 16

def self.verifier_klass
  Decidim::Proposals::Import::ProposalsAnswersVerifier
end

Instance Method Details

#finish!Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/decidim/proposals/import/proposal_answer_creator.rb', line 27

def finish!
  Decidim.traceability.perform_action!(
    "answer",
    resource,
    current_user
  ) do
    resource.try(:save!)
  end

  notify
end

#produceObject

Add answer to proposal

Returns a proposal



23
24
25
# File 'lib/decidim/proposals/import/proposal_answer_creator.rb', line 23

def produce
  resource
end