The Basics
Hot Glue building is a three-step process:
- Build your models (field types, enum types)
- Add your relationships to your models (has_many and belongs_to)
- Generate scaffold
Step 1 - Generate with Rails model generator, include the related tables.
• If you have any Enums, modify the migration before running it.
- All tables must have a label field. It can be either a database column or a method implemented on the class, and must be one of these five special names:
1) name, 2) to_label, 3) full_name, 4) display_name, or 5) email
If you do not already have one of these defined, create a method to_label on your model. This applies to all models built with Hot Glue, and their related models too.
Step 2 - Add has_many and belongs_to to your models
Step 3 - Generate the scaffold. When you generate the scaffold, Hot Glue will read your existing field names and relationships.
rails generate hot_glue:scaffold Thing
(where Thing is the object name of the scaffold you are trying to build)
For each scaffolding you build, Hot Glue generates up to 16 files:
index
edit
_form
_line
_list
_show
_errors
new
_new
_new_button
create.turbo_stream
edit.turbo_stream
update.turbo_stream
destroy.turbo_stream
A controller
A spec file
The 16 files that Hot Glue may generate.
The Top-level views are: index, exit, new, and all 4 turbo_stream responses.