Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
has_many confuse
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Sydore  
View profile  
 More options Oct 1 2012, 6:36 am
From: Sydore <pdo...@gmail.com>
Date: Mon, 1 Oct 2012 03:36:44 -0700 (PDT)
Local: Mon, Oct 1 2012 6:36 am
Subject: has_many confuse

Hi Guys,

I have some issues with the below table relationship.

table_users
id
name

table_invoice
id
date

table_user_invoices
user_id
invoice_id

It doesn't seem to be easy way to manage the has_many for the above tables.

Looking forward for your advise.

Best Regards,
Sydore Pry


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chamnap Chhorn  
View profile  
 More options Oct 1 2012, 8:08 am
From: Chamnap Chhorn <chamnapchh...@gmail.com>
Date: Mon, 1 Oct 2012 19:08:17 +0700
Local: Mon, Oct 1 2012 8:08 am
Subject: Re: has_many confuse

Hi Sydore,

There are two ways to work out, many-to-many relationship, has_many
:through<http://guides.rubyonrails.org/association_basics.html#the-has_many-th...>,
and has_and_belongs_to_many<http://guides.rubyonrails.org/association_basics.html#the-has_and_bel...>
. Check out the differences in the Rails
Guide<http://guides.rubyonrails.org/association_basics.html#choosing-betwee...>
.

In this case, I would suggest you to use has_and_belongs_to_many.

Cheers,
Chamnap

--
Chhorn Chamnap
http://chamnap.github.com/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »