Class: Decidim::Solutions::SolutionsForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Solutions::SolutionsForm
- Includes:
- AttachmentAttributes, HasUploadValidations
- Defined in:
- app/forms/decidim/solutions/solutions_form.rb
Overview
A form object to be used when public users want to create a solution.
Instance Method Summary collapse
- #author ⇒ Object
-
#challenge ⇒ Object
Finds the Challenge from the given decidim_challenges_challenge_id.
- #map_model(model) ⇒ Object
Instance Method Details
#author ⇒ Object
45 46 47 |
# File 'app/forms/decidim/solutions/solutions_form.rb', line 45 def Decidim::User.find() end |
#challenge ⇒ Object
Finds the Challenge from the given decidim_challenges_challenge_id
Returns a Decidim::Challenges::Challenge
41 42 43 |
# File 'app/forms/decidim/solutions/solutions_form.rb', line 41 def challenge @challenge ||= @problem.present? ? Decidim::Challenges::Challenge.find(@problem.challenge.id) : Decidim::Challenges::Challenge.find(@decidim_challenges_challenge_id) end |
#map_model(model) ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/forms/decidim/solutions/solutions_form.rb', line 30 def map_model(model) self.title = translated_attribute(model.title) self.description = translated_attribute(model.description) self.documents = model. nil unless model.categorization end |