与rails的多个关联已审核

时间:2016-02-18 14:55:12

标签: ruby-on-rails ruby ruby-on-rails-4 acts-as-audited

我正在使用Rails的Audited gem,并使用相关的审核:

audited allow_mass_assignment: true, associated_with: :protocol

问题是,我需要将此特定模型的审核与多个模型相关联。我希望这样的东西能起作用:

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

但它没有。 它提供了明确的错误说明:

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

我能找到的唯一related page声称它根本不可能,但它已经很老了,我希望有一些解决方法。

任何帮助都会一如既往地受到赞赏。

2 个答案:

答案 0 :(得分:1)

未经过测试,但在单独的行上试用,例如:

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

答案 1 :(得分:0)

对于搜索您是否可以associated_with使用多个关联的任何人,目前that is not possible

虽然有人提交了PR,但它没有按预期工作。