Class: Decidim::Proposals::ProposalCreator
- Inherits:
-
Admin::Import::Creator
- Object
- Admin::Import::Creator
- Decidim::Proposals::ProposalCreator
- Defined in:
- lib/decidim/proposals/proposal_creator.rb
Overview
This class is responsible for creating the imported proposals and must be included in proposals component’s import manifest.
Class Method Summary collapse
-
.resource_klass ⇒ Object
Retuns the resource class to be created with the provided data.
Instance Method Summary collapse
-
#finish! ⇒ Object
Saves the proposal.
-
#produce ⇒ Object
Produces a proposal from parsed data.
Class Method Details
Instance Method Details
#finish! ⇒ Object
Saves the proposal
23 24 25 26 27 |
# File 'lib/decidim/proposals/proposal_creator.rb', line 23 def finish! super # resource.save! notify(resource) publish(resource) end |
#produce ⇒ Object
Produces a proposal from parsed data
Returns a proposal
16 17 18 19 20 |
# File 'lib/decidim/proposals/proposal_creator.rb', line 16 def produce resource.(context[:current_user], user_group: context[:user_group]) resource end |