26 lines
653 B
Ruby
26 lines
653 B
Ruby
class Employee
|
|
include SimplyStored::Couch
|
|
include ActiveModel::SerializerSupport
|
|
|
|
view :by_confirmation_token, key: :confirmation_token # devise confirmable
|
|
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :confirmable
|
|
property :unconfirmed_email
|
|
|
|
property :name
|
|
#property :email
|
|
|
|
view :by_email, key: :email
|
|
|
|
class << self
|
|
def count_by_email(email)
|
|
database.view by_email(key: email, reduce: true)
|
|
end
|
|
end
|
|
|
|
#validates :email, email: true
|
|
has_and_belongs_to_many :suppliers, storing_keys: false
|
|
has_many :orders
|
|
has_and_belongs_to_many :lists, storing_keys: false
|
|
|
|
end
|