0
我已经在Rails应用程序中配置了Paper_Trail和CanCan。 Rails_Admin很好地向我显示了表versions
和version_associations
。Paper_Trail和CanCan:Rails_Admin不显示版本
在另一个应用程序(实际上是前一个应用程序的一个分支),我想Rails_Admin也显示这些表,但它不。
在我登录与角色admin
用户,并为这两个应用的能力,这两个应用程序是这样的:
class Ability
include CanCan::Ability
def initialize(current_user)
alias_action :create, :read, :update, :destroy, to: :crud
can :read, User
if current_user.nil?
can :create, User
else
can :update, User do |user|
user == current_user # Update himself
end
can :crud, Boilerplate # This is the only line that the 2nd app adds to the ability
if current_user.has_role?(:admin)
can :access, :rails_admin
can :dashboard
can :crud, :all
end
cannot :destroy, User do |user|
user == current_user
end
end
end
end
除了行can :crud, Boilerplate
,都是一样的。迁移也是一样的,所以我有所需的表等。
我创建了每个应用程序的current_ability
转储:diff on diffchecker.com。我能看到的是,在Rails_Admin中看到Paper_Clip内容的用户的能力有很多@expanded_actions
,而另一个则没有。这从哪里来?这两个用户肯定都有:admin
角色。