Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/dfe/analytics/entities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ module Entities
after_create_commit do
extracted_attributes = DfE::Analytics.extract_model_attributes(self)
send_event('create_entity', extracted_attributes) if extracted_attributes.any?
Rails.logger.info("DfE::Analytics: Created entity #{self.class.name} with id #{id} and attributes #{extracted_attributes}")
end

after_destroy_commit do
extracted_attributes = DfE::Analytics.extract_model_attributes(self)
send_event('delete_entity', extracted_attributes) if extracted_attributes.any?
Rails.logger.info("DfE::Analytics: Deleted entity #{self.class.name} with id #{id} and attributes #{extracted_attributes}")
end

after_update_commit do
Expand All @@ -28,6 +30,7 @@ module Entities
allowed_attributes = DfE::Analytics.extract_model_attributes(self).deep_merge(updated_attributes)

send_event('update_entity', allowed_attributes) if updated_attributes.any?
Rails.logger.info("DfE::Analytics: Updated entity #{self.class.name} with id #{id} and attributes #{updated_attributes}")
end
end

Expand Down
Loading