fix profile generation

This commit is contained in:
2023-01-16 01:11:05 +02:00
parent 4ffc6e3c85
commit 63299d4464
14 changed files with 114 additions and 56 deletions

View File

@ -7,7 +7,16 @@ class Member < ApplicationRecord
mount_uploader :picture, PictureUploader
has_many :entities
has_one :profile
has_many :profiles
Profile.types.each do |kind|
define_method :kind do
Profile.where( member_id: self.id).where(kind: kind).first
end
end
def profile( kind )
Profile.where( member_id: self.id).where(kind: kind).first
end
def admin?
email == "torsten@villataika.fi"

View File

@ -8,4 +8,11 @@ class Profile < ApplicationRecord
mount_uploader :picture, PictureUploader
def self.types
["member" , "artist" , "teacher"]
end
def Kind
self.kind.capitalize
end
end