paper trail 是否有办法根据特定角色跟踪用户 activity

whether the paper trail has a way to track the user activity based on a specific role

我正在尝试使用书面记录来跟踪我应用程序中的用户 activity。我已经设置了 gem,按照教程进行操作并使其在我的应用程序中正常工作..

但是,当我作为普通用户(作为来宾用户)对其进行测试时,文件跟踪也跟踪了这个来宾activity,它具有相同的模型和控制器...

有什么方法可以根据角色跟踪用户 activity 吗?

我的意思是,我只想跟踪特定角色的 activity..

需要帮助..

paper trail

i just want to track the activity of a specific [user] role

您可以在控制器中关闭 PaperTrail。来自 documentation:

Turning PaperTrail Off

Per Request

Add a paper_trail_enabled_for_controller method to your controller.

class ApplicationController < ActionController::Base   
  def paper_trail_enabled_for_controller
    !(cool_user? || trustworthy?) # :) this part is up to you
  end
end

如果这不起作用,还有许多其他方法可以打开 PaperTrail on/off 描述了文档。