Class: Decidim::Proposals::CreateProposalExport
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Proposals::CreateProposalExport
- Defined in:
- app/commands/decidim/proposals/create_proposal_export.rb
Overview
A command with all the business logic when a user creates a new proposal.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(participatory_process) ⇒ CreateProposalExport
constructor
Public: Initializes the command.
Constructor Details
#initialize(participatory_process) ⇒ CreateProposalExport
Public: Initializes the command.
form - A form object with the params. current_user - The current user.
11 12 13 |
# File 'app/commands/decidim/proposals/create_proposal_export.rb', line 11 def initialize(participatory_process) @participatory_process = participatory_process end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid, together with the proposal.
-
:invalid if the proposal wasn’t valid and we couldn’t proceed.
Returns nothing.
21 22 23 24 25 26 |
# File 'app/commands/decidim/proposals/create_proposal_export.rb', line 21 def call return broadcast(:invalid) if participatory_process.invalid? create_proposal_export broadcast(:ok, export) end |