我使用本教程:配置和設計
http://www.roberthuberdeau.com/articles/9-Blog-tutorial-part-3
我不知道如何做這些步驟:
We only created a role model. We're left with two choices- finish the scaffold for the role class or create the roles using the command console. I went with the latter as I have command line access to my production environment. I created the following roles, Admin, Moderator, and Author in this exact order. This will be important latter when we set a default user role.
我想做第二個選項:
我不知道如何使用命令控制檯創建角色。我想創建以下角色:管理員和工作人員按此確切順序。
有人可以給我寫命令嗎?
謝謝,但我得到一個錯誤:無法批量分配受保護的屬性:名稱,所以我必須添加到角色模型:attr_accessible:name,對吧? –
是,或者自行指定名稱:'role = Role.new; role.name =「Admin」; role.save' – sgrif