if coauthor not in coauthor db then it will be add in db
This commit is contained in:
1 parent
7f7b33f310
commit
eb97d417bd
2 files changed
+20
-2
No files matched your search
@@ -9,11 +9,12 @@ class CoAuthor
|
||||
field :type
|
||||
|
||||
|
||||
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
|
||||
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/
|
||||
validates :email, format: { with: VALID_EMAIL_REGEX },
|
||||
allow_blank: true,
|
||||
uniqueness: { case_sensitive: false }
|
||||
|
||||
validates :co_author, presence: true
|
||||
before_save { |coauthor| coauthor.email = email.downcase }
|
||||
before_save { |coauthor| coauthor.email = email.downcase if not coauthor.email.nil?}
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user