forked from External/greenlight
add option in settings to delete account
This commit is contained in:
@ -4,6 +4,8 @@ class User < ApplicationRecord
|
||||
after_create :initialize_main_room
|
||||
before_save { email.try(:downcase!) }
|
||||
|
||||
before_destroy :destroy_rooms
|
||||
|
||||
has_many :rooms
|
||||
belongs_to :main_room, class_name: 'Room', foreign_key: :room_id, required: false
|
||||
|
||||
@ -83,6 +85,11 @@ class User < ApplicationRecord
|
||||
|
||||
private
|
||||
|
||||
# Destory a users rooms when they are removed.
|
||||
def destroy_rooms
|
||||
rooms.destroy_all
|
||||
end
|
||||
|
||||
# Initializes a room for the user and assign a BigBlueButton user id.
|
||||
def initialize_main_room
|
||||
self.uid = "gl-#{(0...12).map { (65 + rand(26)).chr }.join.downcase}"
|
||||
|
Reference in New Issue
Block a user