In my Invitation model, the field and attribute are like:
field :recipients, :type => Array
I have an array with 4 messages in my controller, for example:
@invitation.recipients = ['', '', '', '']
I want my model to verify that each array value matches an email regular expression, for example:
validates_format_of :recipients, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[az]{2,})$/u, :message => "is not a valid email address"
How can I check array regex in mongoid?
source share