Form Objects is a solution to handle and process custom requests with custom validations, multi-model requests, etc.
- Forms go under the
app/formsdirectory. - Form name should have suffix
Form(e.g.:app/forms/company_registration_form.rbfile will defineCompanyRegistrationForm) - Form may encapsulate business logic for processing the request, but for complex cases, it is better to consider separate class around the Command Objects layer.
- Form may have
populatemethod where the logic of pre-filling form from a model or other sources can be defined. - Use auxiliary_rails gem.