Validate for a groups of at least 4 items

HI all,

I have 2 tables: groups and items. The relation is 1-* (each group has
many items). In reality each groups should have at least 4 items.

How can I implement an input form so I can input 4 items at the same

And how can I validate the input to ensure that each group must have >=4

Thank you so much for replies.

– ruby/rails newbie