Class: Decidim::Proposals::ProposalWizardCreateStepForm

Inherits:
Form show all
Defined in:
decidim-proposals/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb

Overview

A form object to be used when public users want to create a proposal.

Direct Known Subclasses

ProposalForm

Constant Summary

Constants included from AttributeObject::TypeMap

AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal

Instance Attribute Summary

Attributes inherited from AttributeObject::Form

#context

Instance Method Summary collapse

Methods inherited from AttributeObject::Form

ensure_hash, from_model, from_params, hash_from, infer_model_name, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context

Methods included from AttributeObject::Model

#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h

Instance Method Details

#map_model(model) ⇒ Object


25
26
27
28
29
30
31
32
33
# File 'decidim-proposals/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb', line 25

def map_model(model)
  self.title = translated_attribute(model.title)
  self.body = translated_attribute(model.body)

  self.user_group_id = model.user_groups.first&.id
  return unless model.categorization

  self.category_id = model.categorization.decidim_category_id
end