Class: Decidim::Meetings::Admin::MeetingRegistrationsForm

Inherits:
Form show all
Includes:
TranslatableAttributes
Defined in:
decidim-meetings/app/forms/decidim/meetings/admin/meeting_registrations_form.rb

Overview

This class holds a Form to update meeting registrations from Decidim's admin panel.

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 included from TranslatableAttributes

#default_locale?

Methods inherited from AttributeObject::Form

ensure_hash, from_model, from_params, hash_from, infer_model_name, #map_model, 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

#idObject

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.


47
48
49
50
51
# File 'decidim-meetings/app/forms/decidim/meetings/admin/meeting_registrations_form.rb', line 47

def id
  return super if super.present?

  meeting.id
end