Class: Decidim::Proposals::Import::ProposalAnswerCreator
- Inherits:
-
Admin::Import::Creator
- Object
- Admin::Import::Creator
- Decidim::Proposals::Import::ProposalAnswerCreator
- 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
-
.resource_klass ⇒ Object
Returns the resource class to be created with the provided data.
-
.verifier_klass ⇒ Object
Returns a verifier class to be used to verify the correctness of the import data.
Instance Method Summary collapse
- #finish! ⇒ Object
-
#produce ⇒ Object
Add answer to proposal.
Class Method Details
.resource_klass ⇒ Object
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_klass ⇒ Object
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 |
#produce ⇒ Object
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 |