Files
fizzy/app/models/bubble/commentable.rb
T
2024-10-23 19:13:35 -06:00

14 lines
317 B
Ruby

module Bubble::Commentable
extend ActiveSupport::Concern
included do
has_many :comments
scope :ordered_by_comments, -> { left_joins(:comments).group(:id).order("COUNT(comments.id) DESC") }
end
def comment(body)
thread_entries.create! threadable: Comment.new(body: body, bubble: self)
end
end