class Post < ApplicationRecord
has_many :comments, dependent: :destroy
# comments_count is maintained by counter_cache on Comment#belongs_to
scope :stale_comment_counts, lambda {
<%# Subscribe every viewer of this post to its broadcasts %>
<%= turbo_stream_from @post %>
<%# Update the acting user's button to reflect the toggle %>
<%= turbo_stream.replace dom_id(@post, :like_button) do %>
<%= render "posts/like_button", post: @post %>