V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
stranbird
V2EX  ›  Ruby on Rails

求教一个关于Association的技术问题。

  •  
  •   stranbird · 2011-08-06 17:26:09 +08:00 · 3918 次点击
    这是一个创建于 4644 天前的主题,其中的信息可能已经有所发展或是发生改变。
    有两个模型,一个是man, 一个是link
    man有两种角色,一个是teacher, 一个是student
    现在需要做teacher has_many :students, :through => :link
    student belongs_to :teacher, :through => :link

    也就是link里边要存teacher和student的id,怎么实现?

    最后支持类似于 Man.first.links 的操作。
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3557 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 11:08 · PVG 19:08 · LAX 04:08 · JFK 07:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.