正确关联的Ruby on Rails

编程入门 行业动态 更新时间:2024-10-28 06:35:19
本文介绍了正确关联的Ruby on Rails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有人可以帮助我纠正我的联想?

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

本文发布于:2023-10-28 22:38:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1537973.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:正确   Ruby   Rails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!