Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 967 Bytes

form_objects.md

File metadata and controls

19 lines (13 loc) · 967 Bytes

Form Objects

Introduction

Form Objects is a solution to handle and process custom requests with custom validations, multi-model requests, etc.

Conventions

  • Forms go under the app/forms directory.
  • Form name should have suffix Form (e.g.: app/forms/company_registration_form.rb file will define CompanyRegistrationForm)
  • 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 populate method where the logic of pre-filling form from a model or other sources can be defined.
  • Use auxiliary_rails gem.

References