14 lines
365 B
Ruby
14 lines
365 B
Ruby
module Bubble::Eventable
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
has_many :events # destroyed via thread_entry
|
|
after_create -> { track_event :created }
|
|
end
|
|
|
|
private
|
|
def track_event(action, creator: Current.user, **particulars)
|
|
events.create! action: action, creator: creator, rollup: latest_rollup, particulars: particulars
|
|
end
|
|
end
|