stranbird

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

  •  
  •   stranbird · Aug 6, 2011 · 4793 views
    This topic created in 5400 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   ·   3200 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 11:55 · PVG 19:55 · LAX 04:55 · JFK 07:55
    ♥ Do have faith in what you're doing.