volunteers/app/models/member.rb

27 lines
683 B
Ruby
Raw Normal View History

2022-12-20 16:05:26 +01:00
class Member < ApplicationRecord
2023-02-03 21:29:50 +01:00
def self.visible_scope
where.not(confirmed_at: nil).where.not(picture: nil)
end
2022-12-20 16:29:05 +01:00
# Include default devise modules. Others available are:
# , :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,:confirmable,
2023-01-24 18:04:53 +01:00
:recoverable, :rememberable, :validatable, :async
2022-12-22 15:45:55 +01:00
2022-12-25 16:37:22 +01:00
mount_uploader :picture, PictureUploader
2023-01-11 19:52:58 +01:00
has_many :stories
2023-01-25 21:15:54 +01:00
has_many :stories
has_many :pictures
2023-01-22 19:29:10 +01:00
validates :bio, length: { maximum: 1000 }
validates :name , length: { minimum: 3 }
2022-12-31 21:01:51 +01:00
def admin
2023-01-12 21:24:36 +01:00
self.email == "torsten@villataika.fi"
2022-12-31 21:01:51 +01:00
end
2022-12-22 15:45:55 +01:00
def admin?
2023-01-12 21:24:36 +01:00
self.email == "torsten@villataika.fi"
2022-12-22 15:45:55 +01:00
end
2022-12-20 16:05:26 +01:00
end