has-many-through create! validate presence
问题 I have two models User and Item which are related with a has_many through association. I want to create users without items, but item creation should validate the presence of at least one user. I create items in the following way: @user.items.create!(name: "Ball") What can I do to create a working validation of the presence of a user before creating the item? I tried the following approaches: a validate :users, presence: true in the Item model a validate :item_users, presence: true in the