Files
fizzy/app/models/bubble/eventable.rb
T
Jose Farias ae497aae85 Clear up dependency destruction chain
Buckets destroy their bubbles, which destroy their thread entries, which destroy their threadables, which is how comments end up destroyed, and then rollups end up deleting their events
2024-10-23 14:51:12 -06:00

15 lines
352 B
Ruby

module Bubble::Eventable
extend ActiveSupport::Concern
included do
has_many :events
after_create -> { track_event :created }
end
private
def track_event(action, creator: Current.user, **particulars)
events.create! action: action, creator: creator, particulars: { creator_name: creator.name }.merge(particulars)
end
end