Validate the number of has_many items in Ruby on Rails

A better solution has been provided by @SooDesuNe on this SO post

validates :tags, length: { minimum: 1, maximum: 6 }

Leave a Comment