有人可以帮助我纠正我的联想?
Can someone help me to correct my associations ?
我有以下型号:
User, Developer, Application, Comments, Rating, Permission
要求:
A user can be a Developer or not. A user can have Default Permissions and Permissions for each application A user can install multiple Applications A user can comment and rate multiple Applications A developer can develop multiple applications An application can request a list of permissions.
我已经创造了一些社团,但我相信它不是100%正确,或一个简单的方法来做到这一点存在。
I already created some associations but I believe its not 100% correct or an easier way to do it exist.
有人建议我做一个正确的方法是什么?
Can someone suggest me a correct way to do it?
推荐答案您是混乱的模型授权。
您应该检查出金灿灿的基于角色的授权。例如,你不需要你的开发模式,因为它只是一个不同的角色/权限的用户。
You should check out CanCan for role based authorization. For example you don't need your developer model since its just a user with a different role/permissions.
编辑:改变基于角色的身份验证到基于角色的授权。作为注释下面指出的认证和授权的区别。
Changed 'role based authentication' to 'role based authorization'. As the comment below points out the difference between authentication and authorization.
更多推荐
正确关联的Ruby on Rails
发布评论