Hi.
I was discussing the issue with one of my friends that teaches the databases 
course in the university and he said that more practically is to have this 
small duplication then to use slow outer join queries to list friends. The 
duplication in that case will not cause lot of space in database. It's worth to 
think of that argumentation.

Piotr Jacek Puczynski

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Marnen Laibow-Koser
Sent: Tuesday, July 20, 2010 5:00 PM
To: [email protected]
Subject: [Rails] RE: Re: Creating reflective has_and_belongs_to

Piotr Jacek Puczynski wrote:
> OK.
> I also think the first option is better. However I don't know how to 
> force the model to join based on two columns in join table so that I 
> will be able to write simple 'user.friends' each time I need a friends'
> list. Do you know how to hack it?

See the article I pointed to.  You'll either need a union query or two joins to 
the same table.

If you're going to do this, please make sure you understand the SQL involved.  
ActiveRecord exists to abstract, not to hide.

> 
> Piotr J. Puczyński

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
--
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to