Class: Decidim::Challenges::Admin::ChallengeSurveysForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Challenges::Admin::ChallengeSurveysForm
- Defined in:
- app/forms/decidim/challenges/admin/challenge_surveys_form.rb
Overview
This class holds a Form to update challenges surveys from Decidim’s admin panel.
Instance Method Summary collapse
-
#id ⇒ Object
We need this method to ensure the form object will always have an ID, and thus its ‘to_param` method will always return a significant value.
Instance Method Details
#id ⇒ Object
We need this method to ensure the form object will always have an ID, and thus its ‘to_param` method will always return a significant value. If we remove this method, get an error onn the `update` action and try to resubmit the form, the form will not hold an ID, so the `to_param` method will return an empty string and Rails will treat this as a `create` action, thus raising an error since this action is not defined for the controller we’re using.
TL;DR: if you remove this method, we’ll get errors, so don’t.
21 22 23 24 25 |
# File 'app/forms/decidim/challenges/admin/challenge_surveys_form.rb', line 21 def id return super if super.present? challenge.id end |