新手问题 关于两个表单之间字段调用问题,求指点

lengcb · 2015年10月20日 · 最后由 chenge 回复于 2015年10月20日 · 1379 次阅读

这里有两个表单,一个父表(teams),一个子表(users)(新手,名称说法上有问题请指出),teams.rb 中 has_many :users, user.rb 中 belongs_to :team 我知道 team 中调用 user 表中的字段,用 accepts_nested_attributes_for :users。单反过来就不知道怎么调用了,请各位高手指点

没明白这个 调用是什么意思。

#1 楼 @hging 我要在 team 的 index.html.erb 中显示 user.name,和在 user 的 index.html.erb 中显示 team.name 该如何做

#2 楼 @lengcb 那就直接 term.users.first.name 跟 user.term.name 就好了啊。

...哦。被嫌弃了。那我匿了。LZ 慢慢研究。下次记得贴代码。index.html.erb 的代码

#6 楼 @hging 谢谢了,哈哈

应该是 team.rb 吧。把报错内容贴出来看是什么问题。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号