personal-journal/app/models/journal_paper_author.rb

16 lines
443 B
Ruby
Raw Normal View History

2014-06-12 10:27:26 +00:00
class JournalPaperAuthor
include Mongoid::Document
include Mongoid::Timestamps
field :name, type: String, localize: true
field :email, type: String
2014-06-18 04:09:19 +00:00
field :should_destroy, type: Boolean
2014-06-12 10:27:26 +00:00
has_and_belongs_to_many :journal_papers
has_and_belongs_to_many :journal_paper_author_types
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/
validates :email, format: { with: VALID_EMAIL_REGEX },
2014-06-18 04:09:19 +00:00
allow_blank: true
2014-06-12 10:27:26 +00:00
end