Class: Decidim::Elections::Admin::AnswerForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Elections::Admin::AnswerForm
- Includes:
- AttachmentAttributes, TranslatableAttributes
- Defined in:
- app/forms/decidim/elections/admin/answer_form.rb
Overview
This class holds a Form to create/update answers from Decidim’s admin panel.
Instance Method Summary collapse
Instance Method Details
#election ⇒ Object
33 34 35 |
# File 'app/forms/decidim/elections/admin/answer_form.rb', line 33 def election @election ||= context[:election] end |
#map_model(model) ⇒ Object
22 23 24 |
# File 'app/forms/decidim/elections/admin/answer_form.rb', line 22 def map_model(model) self.proposal_ids = model.linked_resources(:proposals, "related_proposals").pluck(:id) end |
#proposals ⇒ Object
26 27 28 29 30 31 |
# File 'app/forms/decidim/elections/admin/answer_form.rb', line 26 def proposals @proposals ||= Decidim.find_resource_manifest(:proposals) .try(:resource_scope, current_component) &.where(id: proposal_ids) &.order(title: :asc) end |
#question ⇒ Object
37 38 39 |
# File 'app/forms/decidim/elections/admin/answer_form.rb', line 37 def question @question ||= context[:question] end |