简体   繁体   English

在Ruby on Rails中建模部门/部门的未知数量

[英]Modeling unknown # of Departments/Sections in Ruby on Rails

In Ruby on Rails, how can you model a situation where an Employee may belong to a Section and that Section may or may not belong to another Section all the way up to Organization . 在Ruby on Rails中,如何建模一个情况,即Employee可能一直属于某个Section而该Section 可能一直属于或可能不属于另一个Section ,直至Organization I am looking for a set of models that can handle an unknown number of levels. 我正在寻找一组可以处理未知数量级别的模型。 And then finding out the most immediate level an Employee is in, and each Section would have it's own admin(s). 然后找出Employee所处的最直接级别,每个Section将拥有自己的管理员。

I hope to use acl9 for authorization, but still can't figure out how this would be done if the number of levels is unknown. 我希望使用acl9进行授权,但是仍然无法弄清楚如果级别数未知的话该怎么做。

The ancestry gem sounds like it might do what you are looking for. 祖先级的宝石听起来可能像您想要的那样。 There's a railscast on it as well: http://railscasts.com/episodes/262-trees-with-ancestry 上面也有一个railscast: http ://railscasts.com/episodes/262-trees-with-ancestry

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM