How Inspection Templates Work
Source: autosoft-workshop/app/controllers/inspection_templates_controller.rb, inspection_template.rb
- Templates are soft-deleted — they are marked as deleted but never physically removed from the database
- A template item cannot be deleted if it is used in any existing inspection — the reference must be preserved for historical accuracy
- Copying a template clones all comment labels and items, carrying over specific attributes to the new template
- Template name uniqueness is only enforced when creating a new template, NOT when updating — a template can be renamed to a name that already exists
- Template names have a maximum length of 250 characters
- Items within a template are ordered by group_ordering first, then by item ordering, then by created_on date as a tiebreaker
Support scenarios
- "I deleted the template but it's still in the database" → templates are soft-deleted and remain in the database permanently
- "I can't delete this item from the template" → the item is referenced by existing inspections and cannot be removed to preserve inspection history
- "I have two templates with the same name" → name uniqueness is only checked on creation; renaming can create duplicates
- "The items on my template are in the wrong order" → ordering uses group_ordering, then item ordering, then creation date; check all three values