【问题标题】:Multiple associations with rails Audited与 Rails 的多个关联已审核
【发布时间】:2016-05-30 19:34:33
【问题描述】:

我正在为 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 声称这根本不可能,但它已经很老了,我希望有一些解决方法。

一如既往地感谢任何帮助。

【问题讨论】:

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


    【解决方案1】:

    未测试,但在单独的行上尝试,例如:

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

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 2018-11-28
        • 2018-05-11
        • 2013-09-01
        • 2016-03-08
        • 2017-05-09
        • 2012-12-04
        • 2014-08-29
        • 2011-07-14
        • 2018-01-05
        相关资源
        最近更新 更多