Authlogic,多种用户类型和相同模型之间的多种关系
早上好,
我正在尝试找出管理我所拥有的用户情况的最佳方法。
我有用户和附属机构。他们两者之间已经存在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许你可以尝试用单表继承来解决这个问题。文档: 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