simple relationship with has_a

[prev] [thread] [next] [Date index for 2004/08/27]

From: Michael Jensen
Subject: simple relationship with has_a
Date: 15:52 on 27 Aug 2004
I'm new to this list, but I've been using CDBI for about 4 months now. 
I've only used the "CRUD" stuff from the beginners guide so far, so I 
am trying to get my feet wet with other things, like the has_a and 
has_many.

I have a users table and a groups table. Each user has 1 group. I would 
like to get the name of that group while I am calling the users table 
with CDBI.

Users
	id
	username
	email
	group_id

Groups
	id
	name

Right now I just declare the columns for both tables, like in the CRUD 
documentation. I would like to add some has_a and has_many, or whatever 
it takes, so while I am calling the Users table through CDBI I can just 
get the name of the group, even though the id is stored in the users 
table. Can someone give me a few liners?

Thanks!

-Michael Jensen


simple relationship with has_a
Michael Jensen 15:52 on 27 Aug 2004

Re: simple relationship with has_a
Tony Bowden 16:29 on 27 Aug 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52