stranbird

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

  •  
  •   stranbird · Aug 6, 2011 · 4822 views
    This topic created in 5414 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   ·   3419 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 93c8b4a0 · 27ms · UTC 00:34 · PVG 08:34 · LAX 17:34 · JFK 20:34
    ♥ Do have faith in what you're doing.