ingang/app/models/user.rb

13 lines
428 B
Ruby

class User < ApplicationRecord
belongs_to :room
attribute :token, :string, default: -> { SecureRandom.hex(16).to_i(16).to_s(36) }
attribute :moderator, :boolean, default: false
attribute :invited, :boolean, default: false
attribute :vote, :boolean, default: true
attribute :proxy, :boolean, default: false
validates :email, uniqueness: { scope: :room_id }
validates :room_id, uniqueness: { scope: :email }
end