2020-03-07 05:39:00 +01:00
|
|
|
class User < BaseModel
|
|
|
|
include Carbon::Emailable
|
|
|
|
include Authentic::PasswordAuthenticatable
|
|
|
|
|
|
|
|
table do
|
|
|
|
column name : String
|
|
|
|
column encrypted_password : String
|
2020-03-07 20:01:11 +01:00
|
|
|
column email : String
|
2020-03-07 23:32:07 +01:00
|
|
|
column created_at : Time, autogenerated: true
|
2020-03-07 05:39:00 +01:00
|
|
|
|
|
|
|
belongs_to primary_role : Role
|
|
|
|
has_many posts : Post, foreign_key: :creator_id
|
|
|
|
end
|
|
|
|
|
|
|
|
def emailable : Carbon::Address
|
|
|
|
Carbon::Address.new(email)
|
|
|
|
end
|
|
|
|
end
|