I would like to implement certain relationship between 2 models.
I have 2 models: quiz and question that have many-to-many relationship. Quiz model have quiz_flag and question model have question_flag.
What I want to happen is when quiz_flag is changed to true, every question that is in direct relationship (basically every question that is contained within that quiz), should also change question_flag to true.
Logic is similar to dependent: :destroy, but it's a custom function that I want to trigger when quiz_flag becomes true. But how do I specifically do that?
Aucun commentaire:
Enregistrer un commentaire