This commit is contained in:
2025-11-07 13:34:32 -08:00
commit 1e8c5a972b
436 changed files with 11000 additions and 0 deletions

15
app/models/leaf.rb Normal file
View File

@@ -0,0 +1,15 @@
class Leaf < ApplicationRecord
include Editable, Positionable
belongs_to :book, touch: true
delegated_type :leafable, types: Leafable::TYPES, dependent: :destroy
positioned_within :book, association: :leaves, filter: :active
enum :status, %w[ active trashed ].index_by(&:itself), default: :active
scope :with_leafables, -> { includes(:leafable) }
def slug
title.parameterize.presence || "-"
end
end