19 lines
398 B
Crystal
19 lines
398 B
Crystal
|
class User < BaseModel
|
||
|
include Carbon::Emailable
|
||
|
include Authentic::PasswordAuthenticatable
|
||
|
|
||
|
table do
|
||
|
column name : String
|
||
|
column encrypted_password : String
|
||
|
column email : String?
|
||
|
column created_at : Time
|
||
|
|
||
|
belongs_to primary_role : Role
|
||
|
has_many posts : Post, foreign_key: :creator_id
|
||
|
end
|
||
|
|
||
|
def emailable : Carbon::Address
|
||
|
Carbon::Address.new(email)
|
||
|
end
|
||
|
end
|