2016-03-02 63 views
0

我有一个这样的东西的yml文件,我写了 角色标签中的所有角色。yml rails中的继承?

admin标签继承角色的所有属性,但我想defalut标签应该只继承role_5。怎么做??

roles: &all 
role_1: "edit" 
role_2: "create" 
role_3: "read" 
role_4: "update" 
role_5: "writepost" 

admin: 
<<: *all #inherits all 


default : 
    <<:only inherit role_5 # what should i write ??? 

回答

1

像这样:

roles: &all 
role_1: "edit" 
role_2: "create" 
role_3: "read" 
role_4: "update" 
role_5: &role_5 
    "writepost" 

admin: 
<<: *all #inherits all 


default: *role_5