新手问题 如何调用 belongs_to 的 model 方法???急谢谢

ckl · 2014年03月25日 · 最后由 zj0713001 回复于 2014年03月25日 · 1834 次阅读

User model has_many :works def find puts “hello world” end

Work model belongs_to :user

Work model 的对象 test 如何调用 User model 中的方法???

我在代码中试了 test.user.find 不可以

@miclle 不好意思 方法举例错误!方法改为 bar

@miclle 谢谢了 我找到了!

test.user.class.find

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