can select relection from relation db
This commit is contained in:
1 parent
0e6c75e677
commit
e143f9a345
6 files changed
+18
-20
No files matched your search
@@ -13,7 +13,7 @@ class CoAuthor
|
||||
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 }
|
||||
uniqueness: { case_sensitive: false }
|
||||
|
||||
validates :co_author, presence: true
|
||||
before_save { |coauthor| coauthor.email = email.downcase if not coauthor.email.nil?}
|
||||
|
||||
@@ -5,4 +5,6 @@ class CoAuthorRelation
|
||||
field :relation, localize: true
|
||||
|
||||
has_and_belongs_to_many :co_authors
|
||||
|
||||
validates :relation, presence: true
|
||||
end
|
||||
@@ -3,7 +3,7 @@ class User
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :timeoutable
|
||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable, :timeoutable
|
||||
|
||||
mount_uploader :avatar, AvatarUploader
|
||||
|
||||
@@ -194,4 +194,4 @@ class User
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user