2015-06-03 22 views
0

我已經在Rails應用程序中配置了Paper_Trail和CanCan。 Rails_Admin很好地向我顯示了表versionsversion_associationsPaper_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角色。

回答

0

問題是我沒有使用最新的paper_trail版本(4.0.0.rc版本)。