Class: Decidim::Budgets::Admin::BudgetForm
- Inherits:
-
Form
- Object
- AttributeObject::Form
- Form
- Decidim::Budgets::Admin::BudgetForm
- Includes:
- TranslatableAttributes
- Defined in:
- decidim-budgets/app/forms/decidim/budgets/admin/budget_form.rb
Overview
This class holds a Form to create/update budgets 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
Instance Method Summary collapse
-
#decidim_scope_id ⇒ Object
Scope identifier.
-
#scope ⇒ Object
Finds the Scope from the given decidim_scope_id, uses the compoenent scope if missing.
Methods included from TranslatableAttributes
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
#decidim_scope_id ⇒ Object
Scope identifier
Returns the scope identifier related to the meeting
33 34 35 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/budget_form.rb', line 33 def decidim_scope_id super || scope&.id end |
#scope ⇒ Object
Finds the Scope from the given decidim_scope_id, uses the compoenent scope if missing.
Returns a Decidim::Scope
26 27 28 |
# File 'decidim-budgets/app/forms/decidim/budgets/admin/budget_form.rb', line 26 def scope @scope ||= @attributes["decidim_scope_id"].value ? current_component.scopes.find_by(id: @attributes["decidim_scope_id"].value) : current_component.scope end |