volunteers/app/models/member.rb
2023-05-27 20:42:54 +03:00

31 lines
771 B
Ruby

class Member < ApplicationRecord
def self.public_scope
where.not(confirmed_at: nil).where.not(picture: nil)
end
def self.visible_scope
where.not(confirmed_at: nil).where.not(arrived: nil)
end
# Include default devise modules. Others available are:
# , :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,:confirmable,
:recoverable, :rememberable, :validatable, :async
mount_uploader :picture, PictureUploader
has_many :stories
has_many :stories
has_many :pictures
validates :bio, length: { maximum: 1000 }
validates :name , length: { minimum: 3 }
def admin
self.email == "torsten@villataika.fi"
end
def admin?
self.email == "torsten@villataika.fi"
end
end