I have this model:
class Campaign
include Mongoid::Document
include Mongoid::Timestamps
field :name, :type => String
field :subdomain, :type => String
field :intro, :type => String
field :body, :type => String
field :emails, :type => Array
end
Now I want to validate that each email in the emails
array is formatted correctly. I read the Mongoid and ActiveModel::Validations documentation but I didn't find how to do this.
Can you show me a pointer?