Authlogic,多种用户类型和相同模型之间的多种关系

发布于 2024-09-13 20:45:27 字数 300 浏览 6 评论 0原文

早上好,

我正在尝试找出管理我所拥有的用户情况的最佳方法。

我有用户和附属机构。他们两者之间已经存在HABTM关系,因为用户可以注册附属公司,附属公司可以伸手接触用户,从而获得各种数据点。

现在我需要设置一个新的 Authlogic 用户类型(我们将其称为联属经理)来管理联属会员。每个联属经理只能管理一个联属会员,并且不应计入该联属会员的用户数。

我们的应用程序已经使用 Authlogic 来区分普通用户和管理员,但我很难思考如何在最新的文章中构建:特别是附属机构和经理之间的关系。

感谢您的任何帮助。

Good morning,

I'm trying to figure out the best way to manage this user situation I've got.

I have users and affiliates. There is already a HABTM relationship between the two of them, because users can sign up for affiliates, and affiliates can reach out and touch users, in order to get various data points.

Now I need to set up a new Authlogic user type, let's call them affiliate managers, to manage affiliates. Each affiliate manager can only manage one affiliate, and they should not be counted in the affiliate's user count.

Our app is already using Authlogic to separate regular users and admins, but I'm having a hard time wrapping my brain around how I would build in this latest piece: specifically the relationship between the affiliate and the manager.

Thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆梦 2024-09-20 20:45:27

也许你可以尝试用单表继承来解决这个问题。文档: http://api.rubyonrails.org/classes /ActiveRecord/Base.html#label-Single+table+inheritance

Maybe you can try to solve this with single table inheritance. Docs: http://api.rubyonrails.org/classes/ActiveRecord/Base.html#label-Single+table+inheritance

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文