Module: OpenLoam::Commentable

Extended by:
ActiveSupport::Concern
Defined in:
lib/open_loam/commentable.rb

Overview

Discussion on a record:

equipment.comment!("Hydraulics serviced")   # as OpenLoam.actor
equipment.open_loam_comments.oldest_first

Included by every generated entity. Comments are tenant-scoped like their subject, so a discussion can never be read from another tenant.

Instance Method Summary collapse

Instance Method Details

#comment!(body, author: OpenLoam::Current.actor) ⇒ Object

Author defaults to whoever is acting — the same person the audit trail and the event payload would name.



18
19
20
# File 'lib/open_loam/commentable.rb', line 18

def comment!(body, author: OpenLoam::Current.actor)
  open_loam_comments.create!(body: body, author: author)
end