hubfeenix.fi/app/models/profile.rb

24 lines
455 B
Ruby
Raw Normal View History

2023-01-15 23:17:22 +01:00
class Profile < ApplicationRecord
2023-01-15 13:52:40 +01:00
belongs_to :member
2023-01-16 17:59:07 +01:00
has_many :events
2023-01-20 13:59:34 +01:00
2023-01-15 13:52:40 +01:00
validates :name , presence: true
2023-01-15 23:17:22 +01:00
validates :kind , presence: true
2023-01-15 13:52:40 +01:00
validates :bio , presence: true
validates :picture , presence: true
mount_uploader :picture, PictureUploader
2023-01-20 13:59:34 +01:00
def self.kinds
2023-01-16 00:11:05 +01:00
["member" , "artist" , "teacher"]
end
def Kind
self.kind.capitalize
end
2023-06-12 14:47:54 +02:00
def future_events
self.events.where( "start_date > ?" , Date.today)
end
2023-01-15 13:52:40 +01:00
end