class Shamu::Auditing::Transaction
An audit record of a discrete change transaction.
Attributes
entities[R]
Public Instance Methods
append_entity( entity )
click to toggle source
Appends a child node to the {#entity_path}. @overload append_entity
( entity )
@param [Entities::Entity] an entity
@overload append_entity
( pair )
@param [Array<String,Object>] pair consisting of entity class and id.
# File lib/shamu/auditing/transaction.rb, line 40 def append_entity( entity ) @entities ||= [] entities << entity end
apply_to( model )
click to toggle source
(see Services::Request#apply_to
)
Calls superclass method
# File lib/shamu/auditing/transaction.rb, line 46 def apply_to( model ) super.tap do assign_changes_to_model model end end
entities?()
click to toggle source
@return [Boolean] true if entities have been added to the transaction.
# File lib/shamu/auditing/transaction.rb, line 53 def entities? entities.present? end
Private Instance Methods
assign_changes_to_model( model )
click to toggle source
# File lib/shamu/auditing/transaction.rb, line 62 def assign_changes_to_model( model ) model.changes_json = changes.to_json if changes.present? end