How Inspection Model Validation Works
Source: autosoft-workshop/app/models/inspection.rb
- Creating an inspection requires customer_id, vehicle_id, company_id, and inspection_date — all four are mandatory
- At least one contact method (email or phone number) must be provided — an inspection with neither will fail validation
- Customer email validation is commented out in the code — a customer's email address is NOT required to create an inspection, even though the field exists
- New inspections always start in Draft status regardless of what status is submitted
- Comment labels default to "Comment 1" and "Comment 2" unless overridden by the template being used
- Estimated time thresholds are only available for draft inspections that have a template assigned — after finalization, thresholds return 0
- Field length limits: description 255 characters, contact_name 255 characters, contact_number 35 characters, contact_email 255 characters
Support scenarios
- "I can't create an inspection" → check that customer_id, vehicle_id, company_id, inspection_date, and at least one contact method are all provided
- "The inspection was created as draft even though I set it to finalized" → new inspections always start as Draft; finalization is a separate step
- "The customer email wasn't required when creating the inspection" → email validation is commented out in the code; this is intentional current behavior
- "Estimated time thresholds show zero" → thresholds only appear for draft inspections with a template; after finalization they are zeroed out
- "My description got truncated" → descriptions are limited to 255 characters