2016-03-02 58 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