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

lengcb · October 20, 2015 · Last by chenge replied at October 20, 2015 · 1379 hits

这里有两个表单,一个父表(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 吧。把报错内容贴出来看是什么问题。

You need to Sign in before reply, if you don't have an account, please Sign up first.