add user document model
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
# index_users_on_email (email) UNIQUE
|
||||
#
|
||||
class User < ApplicationRecord
|
||||
has_many :documents, class_name: "UserDocument", dependent: :destroy
|
||||
|
||||
validates :first_name, :last_name, :email, presence: true
|
||||
|
||||
def full_name
|
||||
|
||||
30
app/models/user_document.rb
Normal file
30
app/models/user_document.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: user_documents
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# status :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_user_documents_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class UserDocument < ApplicationRecord
|
||||
extend Enumerize
|
||||
|
||||
belongs_to :user
|
||||
has_one_attached :image
|
||||
|
||||
enumerize :status,
|
||||
in: [:pending_review, :approved, :refused],
|
||||
default: :pending_review
|
||||
end
|
||||
Reference in New Issue
Block a user