Sha256: 3a2b7510b4c143abd421de04d3a73d14fbbe5c93d7ebd883728adee8d72c97bd
Contents?: true
Size: 783 Bytes
Versions: 1
Compression:
Stored size: 783 Bytes
Contents
module ChooChoo module ParentNode extend ActiveSupport::Concern included do # TODO: break out into base_event? after_create :on_create after_update :on_update before_destroy :on_destroy has_one :activity, as: :parent_node, class_name: 'ChooChoo::Activity', dependent: :destroy end # called from subactivites when something has happened def child_event_happened(activity_name, model) # facade self.activity.event_happened(activity_name, model) end private def on_create ChooChoo::Activity.create(parent_node: self) end def on_update self.activity.event_happened('updated', self) end def on_destroy self.activity.event_happened('destroyed', nil) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
choo_choo-0.0.1 | app/models/choo_choo/parent_node.rb |