V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
stranbird

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

  •  
  •   stranbird · Aug 6, 2011 · 4772 views
    This topic created in 5391 days ago, the information mentioned may be changed or developed.
    有两个模型,一个是man, 一个是link
    man有两种角色,一个是teacher, 一个是student
    现在需要做teacher has_many :students, :through => :link
    student belongs_to :teacher, :through => :link

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

    最后支持类似于 Man.first.links 的操作。
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   874 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 21:38 · PVG 05:38 · LAX 14:38 · JFK 17:38
    ♥ Do have faith in what you're doing.