24 lines
497 B
Ruby
24 lines
497 B
Ruby
class Profile < ApplicationRecord
|
|
belongs_to :member
|
|
has_many :events
|
|
|
|
validates_length_of :name , minimum: 3 , maximum: 100
|
|
validates_length_of :bio , minimum: 30 , maximum: 600
|
|
validates :kind , presence: true
|
|
validates :picture , presence: true
|
|
|
|
mount_uploader :picture, PictureUploader
|
|
|
|
def self.kinds
|
|
["member" , "artist" , "teacher"]
|
|
end
|
|
|
|
def Kind
|
|
self.kind.capitalize
|
|
end
|
|
|
|
def future_events
|
|
self.events.where( "start_date > ?" , Date.today)
|
|
end
|
|
end
|