I have 3 models: Open House, Attendee, and Registration (Registration is a join model to allow attendees to register for open houses. A registration belongs to an Open House and an attendee).
How do I create a validation on the Open House model that prevents an Attendee from registering twice for the same Open House?
I'm a little confused because the :attendee_id is on the Registration rather than the Open House, and that is the attribute that defines uniqueness in this scenario. Any help is appreciated!
question from:
https://stackoverflow.com/questions/65945029/how-to-validate-uniqueness-in-join-table-record 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…