获取Paper_trail + Rails_admin +具有多个“用户”模型的设计 [英] Getting Paper_trail + Rails_admin + Devise with Multiple 'user' models
问题描述
config.audit_with:paper_trail,User
有没有办法让用户和管理员进行paper_trail监视更改,它只跟随一个模型?我注意到,即使这样设置,并且我作为管理员从Rails_admin内进行更改,更改说明是由用户与管理员相同的ID进行的做出改变。
处理这个的最好方法是安装CanCan,删除我的管理模型,并利用针对当前情况,单个模型中的多个角色。
I am developing an app in Rails 3, currently I use Devise as the login and Rails_admin as the admin panel with Paper_trail tracking all changes made by 'user' model... Problem is I have two user models, User and Admin. So a line of code in rails_admin.rb (initiliazer) to setup Paper_trail to track history:
config.audit_with :paper_trail, User
Is there any way to have paper_trail monitor changes made by both User and Admin, or can it only follow one model? I notice that even when it is set like this, and I make a change from within Rails_admin as an admin, the change says it was made by the User with the same ID as the admin that made the change.
The best way to handle this is to install CanCan, remove my Admin Model, and take advantage of using Multiple Roles within a single model for the current situation.
这篇关于获取Paper_trail + Rails_admin +具有多个“用户”模型的设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!