hubfeenix.fi/app/models/profile.rb

24 lines
497 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-09-06 11:51:16 +02:00
validates_length_of :name , minimum: 3 , maximum: 100
validates_length_of :bio , minimum: 30 , maximum: 600
2023-01-15 23:17:22 +01:00
validates :kind , presence: true
2023-01-15 13:52:40 +01:00
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