Cocoon add association, how to limit number of associations
I am creating a system that stores cards using Ruby/Rails/HAML - In this case there is a Card class that has many Colours (this is also a class). When creating and editing a card I am using the Cocoon gem to allow me to dynamically add colour associations. The problem I am having is that in the Card model, a card is limited to having a maximum of 5 colours. Yet the interface allows adding of unlimited colours resulting in an error. Is there a way in Cocoon to limit the number of associations that can be added to a form, so that this limit is not exceeded? This is the code for a form to add