【发布时间】:2023-03-24 17:08:01
【问题描述】:
我想要通过如下简单设置实现学徒关系
class Apprentice
attr_accessible :apprentice, :mentor, :other_details
has_one :employee #contains the apprentice information
has_one :employee #contains the mentor information
end
class Employee
attr_accessible :name, :age, :gender
end
如何让员工在学徒对象中既是学徒又是导师?此外,由于我还有其他需要使用它的对象,因此我使 Employee 具有多态性。
非常感谢您的帮助。
【问题讨论】:
-
嗨,Marc,感谢您编辑我的笔记。你是怎么把所有的空间都没有 html 的?
标签: ruby-on-rails activerecord has-one