can select relection from relation db

This commit is contained in:
Rueshyna authored and chris committed 2012-12-04 00:31:46 +08:00
1 parent 0e6c75e677
commit e143f9a345
6 files changed
+18 -20

No files matched your search

+1 -1
View File
@@ -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?}
+2
View File
@@ -5,4 +5,6 @@ class CoAuthorRelation
field :relation, localize: true
has_and_belongs_to_many :co_authors
validates :relation, presence: true
end
+2 -2
View File
@@ -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