[ROR]has_many and belongs_to..

5 views
Skip to first unread message

B.Tag

unread,
Aug 25, 2011, 5:12:47 AM8/25/11
to chengdu...@googlegroups.com
英文太差了 没看明白 has_many  and belongs_to

这两个是如何关联起来的

比如 我有member表和member_count表

member有id name password
*_count 有uid first_name email  site.....等 uid 是member的ID

我使用 has_many :member_counts belongs_to :member

我在终端下rails c 

m = Member.first
m.member_counts.ids=1

结果显示没有这个方法

对这两个的用法表示很疑惑。。我如果要访问member_count 是不是必须new这个对象呢??

--
-------------------------------------------------------------------------
        learn log: http://me.boolsir.com 
        my life log: http://www.boolsir.com
-------------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages