luckybooru/src/models/user.cr

19 lines
418 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, autogenerated: true
belongs_to primary_role : Role
has_many posts : Post, foreign_key: :creator_id
end
def emailable : Carbon::Address
Carbon::Address.new(email)
end
end