1

I am using the Audited gem for Rails, and am using the associated audits like so:

audited allow_mass_assignment: true, associated_with: :protocol

The problem is, I need this particular model's audits to be associated with more than one models. I was hoping that something like this will work:

audited allow_mass_assignment: true, associated_with: [:protocol, :patient]

But it doesn't. It provides a clear error stating:

[:protocol, :patient] is not a symbol nor a string

The only related page I could find claims it is simply not possible, but it is quite old and I hope there is some workaround.

Any help is appreciated as always.

DannyB
  • 12,810
  • 5
  • 55
  • 65

2 Answers2

1

Not tested it but try it on seperate lines, like:

audited allow_mass_assignment: true, associated_with: :protocol
audited allow_mass_assignment: true, associated_with: :patient
andreofthecape
  • 1,166
  • 11
  • 24
1

For anyone searching if you can use associated_with with multiple associations, currently that is not possible.

Although, someone submitted a PR, it did not work as expected.

alexts
  • 180
  • 2
  • 13