Add basic invitations
This commit is contained in:
14
app/models/invitation.rb
Normal file
14
app/models/invitation.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class Invitation < ApplicationRecord
|
||||
# Relations
|
||||
belongs_to :user
|
||||
|
||||
validates_presence_of :user
|
||||
|
||||
before_create :generate_token
|
||||
|
||||
private
|
||||
|
||||
def generate_token
|
||||
self.token = SecureRandom.hex(8)
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,7 @@
|
||||
class User < ApplicationRecord
|
||||
# Relations
|
||||
has_many :invitations, dependent: :destroy
|
||||
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
devise :ldap_authenticatable,
|
||||
|
||||
Reference in New Issue
Block a user