Files
sanasto-wiki/app/models/entry.rb

20 lines
468 B
Ruby

class Entry < ApplicationRecord
belongs_to :created_by, class_name: "User", optional: true
belongs_to :updated_by, class_name: "User", optional: true
has_many :suggested_meanings, dependent: :destroy
has_many :comments, as: :commentable, dependent: :destroy
has_many :entry_versions, dependent: :destroy
enum category: {
word: 0,
phrase: 1,
name: 2,
title: 3,
reference: 4,
other: 5
}
validates :category, presence: true
end