add co-author db and curd page, but it can't destory it...
This commit is contained in:
1 parent
6a9426c9c8
commit
d502f561ef
7 files changed
+160
No files matched your search
@@ -0,0 +1,19 @@
|
||||
class CoAuthor
|
||||
include Mongoid::Document
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
||||
field :name_id, type: BSON::ObjectId
|
||||
field :co_author, localize: true
|
||||
field :email
|
||||
field :type
|
||||
|
||||
|
||||
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
|
||||
validates :email, format: { with: VALID_EMAIL_REGEX },
|
||||
uniqueness: { case_sensitive: false }
|
||||
|
||||
validates :co_author, presence: true
|
||||
before_save { |coauthor| coauthor.email = email.downcase }
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user