2018-08-27 14:37:06 +00:00
|
|
|
class User < ApplicationRecord
|
2018-08-29 13:53:39 +00:00
|
|
|
|
2018-08-27 14:37:06 +00:00
|
|
|
# Include default devise modules. Others available are:
|
|
|
|
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
|
|
|
devise :database_authenticatable, :registerable,
|
|
|
|
:recoverable, :rememberable, :validatable
|
2018-08-27 15:55:44 +00:00
|
|
|
|
|
|
|
has_many :connections
|
2018-08-29 12:44:10 +00:00
|
|
|
has_many :chat_room_participations
|
2018-08-30 02:00:09 +00:00
|
|
|
has_many :chat_rooms, through: :chat_room_participations
|
2018-08-29 12:44:10 +00:00
|
|
|
has_many :requests
|
2018-08-27 15:55:44 +00:00
|
|
|
|
2018-08-29 15:58:21 +00:00
|
|
|
mount_uploader :photo, PhotoUploader
|
|
|
|
|
2018-08-27 15:55:44 +00:00
|
|
|
def contacts
|
|
|
|
self.connections.map do |connection|
|
|
|
|
connection.contact
|
|
|
|
end
|
|
|
|
end
|
2018-08-27 14:37:06 +00:00
|
|
|
end
|