Authlogic, multiple user types and multiple relationships between the same models

Good morning,

I am trying to find the best way to manage this situation with the user.

I have users and branches. There is already a HABTM relationship between the two of them, as users can register for branches, and branches can contact and contact users to get different data points.

Now I need to configure a new Authlogic user type, let them link branch managers to manage branches. Each partner partner can manage only one affiliate, and they should not be counted in the user count.

Our application already uses Authlogic to distinguish between ordinary users and administrators, but it's hard for me to build my brain around how I will use this last part: in particular, the relationship between an affiliate and a manager.

Thanks for any help.

+3
source share
1 answer

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

0
source

Source: https://habr.com/ru/post/1758915/


All Articles