Module: Decidim::FormFactory

Overview

A factory to build forms. This is done to add a context when possible, so that forms can act based on data that varies between requests. This is mostly done so that i18n form fields can be properly validated with the `current_organization` available locales, instead of doing so against all the available locales in the platform. The `current_organization` varies between requests, so the form need some way to access this data.

Examples:

# in a controller, mostly in a `create` action:
form(MyFormClass).form_params(params)

# in a controller, mostly in a `new` action:
form(MyFormClass).instance

# in a controller, mostly in an `edit` action:
form(MyFormClass).form_model(@my_resource)