Rails flexible checklists

26 Views Asked by At

I need advice if my approach is right I would like to create a digital checklist for several test types with the possibility that users can add further questions to the checklist at any time. I have four models for this. Questions, Checkpoints, CheckTypes and Checks Question Users should be able to create questions. Each question has such a check type (name:string checktyp_id:integer) Example Name: "Is enough oil in the tank", checktyp_id:1

Check type There are basically three types of testing (small, medium and large) Example Name: "Small Check"

Checkpoint each probe has the following values passed (io:boolean) failed (nio:booelean) OK after repair(inst_io:boolean) the examiner (user_id:integer) test date(check_date:date) Example: Check_id:integer, Question_id:integer, io:boolean, nio:booelean, inst_io:boolean, user_id:integer, check_date:date

Checks This is the main form. If the action new is called there, the CheckTyp_id should also be selected.

The behavior of the form: The Check new action is called with the parameter checktyp_id:1. Now all questions with this checktyp_id should be available in the form. Each question should then have the choices (io, nio, inst_io...) in the form.

The model connections:

Question 
->belongs_to check type



Check type 
-> Has_many questions 

Checkpoint 
-> Belongs_to question 
-> Belongs_to check 

Check 
-> has_many questions trough checktyp_id 
-> has_many checkpoints 
-> belongs_to check type 

Is this correct, or am I thinking too complex?

0

There are 0 best solutions below