[Rails] Rails theory question, where to put a join query
Horacio J. Peña
horape at compendium.com.ar
Wed Aug 16 16:41:57 GMT 2006
> Hmm.. You make sense. When I first started I didn't really understand
> things and so I was doing something like:
> find_by_sql("SELECT * FROM authors,posts WHERE authors.id = posts.authorid")
> But you're right I can just do an association can't I?
> Is there no extra overhead to doing the association? I've read about
> inefficiencies with Rails queries (ie. generating many unnecessary
> queries).. Maybe that was in a many to many situation. Maybe I'm being a
> bit paranoid.
If you want to avoid the extra queries you can use :include option so it
gets all the data on just one query.
Saludos!
HoraPe
---
Horacio J. Peña
horape at compendium.com.ar
horape at uninet.edu
More information about the Rails
mailing list