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

13 lines
427 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, %i[word phrase proper_name title reference other]
validates :category, presence: true
end