c57f18c20c
The domain language is clearer if we just persist a thread. Also rename some models so their purpose is clear.
14 lines
296 B
Ruby
14 lines
296 B
Ruby
class Bubble::Thread < ApplicationRecord
|
|
belongs_to :bubble, touch: true
|
|
|
|
has_many :entries, -> { chronologically }, dependent: :destroy
|
|
|
|
def latest_rollup
|
|
entries.last&.event_rollup || Event::Rollup.new(thread: self)
|
|
end
|
|
|
|
def to_partial_path
|
|
"bubbles/threads/thread"
|
|
end
|
|
end
|