Thursday, September 16, 2010

[Rails] Re: has_many and bi-directional relationships

pipplo wrote:
> I'm working on an app with a friend type system. I currently have
> setup like this with 2 tables.
>
> users table keeps track of users
>
> user_relationships table keeps track of friendships. Now, there
> should be two rows for each relationship. This is to keep track of
> the directional nature of the relationship between users. Each time a
> relationship is made, both rows should be inserted into the table.
>
> user_1 user_2 data
> user_2 user_1 data
[...]

That's not necessarily a great idea. Please see
http://www.ruby-forum.com/topic/213468 .

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate