[英]rails, how to validate that an associated record exists before saving?
I have the following models:我有以下型号:
Groups, and then GroupMembers.组,然后是 GroupMembers。
I don't want a group to be allowed to be saved there is at least one groupmember model associated via a build.我不希望允许保存一个组,至少有一个组成员 model 通过构建关联。
how can I do that in the model?我怎么能在 model 中做到这一点? Thanks谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.