I have in model Invitation a field and attribute like:
field :recipients, :type => Array
I have an array with 4 emails in my controller like:
@invitation.recipients = ['', '', '', '']
I want validate in my model that each array's value match with a email regex sth like:
validates_format_of :recipients, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/u, :message => "is not a valid email address"
How can I validate regex of an array in mongoid?