fix profile generation
This commit is contained in:
@ -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"
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user