audited icon indicating copy to clipboard operation
audited copied to clipboard

A way to audit associations

Open mhratson opened this issue 6 years ago • 1 comments

Problem

As a developer I need to audit model associations changes.

Example

A Team has many Members. When adding/removing members through a form submission capture memberships changes in the Team audit similar to how Team name would be audited.

Our Workaround

we've developed small module to solve this for us, it works like this:

  1. override membership_associations=
  2. capture membership_attributes before and after change
  3. add the memberships attribute to the audited_changes hash

This works for us due to associations being small so captured hash is fairly small.

Question

  1. Are there any plans Audited have this functionality?
  2. If so would PR adding above functionality be a good idea?

Thank you!

mhratson avatar Apr 26 '19 20:04 mhratson

@mhratson 3 years forward I'm dealing with the same issue. Would you mind sharing some code snippets if you ever see this comment? ;)

oskargargas avatar Jul 14 '22 08:07 oskargargas