validate at least one in has_and_belongs_to_many

前端 未结 5 940
生来不讨喜
生来不讨喜 2020-12-18 18:33

I have a model with:

has_and_belongs_to_many :users

How do I validate that the model has at least one user in the model? I tried:

5条回答
提交回复
热议问题