polyglot/app/models/user.rb

23 lines
584 B
Ruby
Raw Permalink Normal View History

class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :connections
2018-08-29 12:44:10 +00:00
has_many :chat_room_participations
has_many :chat_rooms, through: :chat_room_participations
2018-08-29 12:44:10 +00:00
has_many :requests
2018-09-04 12:50:44 +00:00
validates :email, uniqueness: true
2018-08-29 15:58:21 +00:00
mount_uploader :photo, PhotoUploader
def contacts
self.connections.map do |connection|
connection.contact
end
end
end