Class: Invite
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Invite
- Defined in:
- app/models/invite.rb
Overview
Invites are created by foodcoop users to invite a new user into the foodcoop and their order group.
Instance Method Summary collapse
-
#set_token_and_expires_at ⇒ Object
protected
Before validation, set token and expires_at.
Instance Method Details
#set_token_and_expires_at ⇒ Object (protected)
Before validation, set token and expires_at.
20 21 22 23 |
# File 'app/models/invite.rb', line 20 def set_token_and_expires_at self.token = Digest::SHA1.hexdigest(Time.now.to_s + rand(100).to_s) self.expires_at = Time.now.advance(days: 7) end |