# Execute joins manually without :include parameter

**URL:** <https://www.ruby-forum.com/t/execute-joins-manually-without-include-parameter/113393>\
**Category:** Rails\
**Created:** [August 30, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/execute-joins-manually-without-include-parameter/113393 "2007-08-30T17:25:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gABoCas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ad7895/32.png) [@gABoCas](https://www.ruby-forum.com/u/gABoCas)\
**Post date:** [August 30, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/execute-joins-manually-without-include-parameter/113393/1 "2007-08-30T17:25:45Z")

</div>

Hi!

I have the next model with the follow associations:

class XmlGen \< ActiveRecord::Base  
set\_primary\_key “pk”  
belongs\_to :serie,  
:foreign\_key =\> “series\_fk”

class Serie \< ActiveRecord::Base  
set\_primary\_key “pk”  
belongs\_to :study, #Relaciones entre las clases Study y Series. A  
study has many series.  
:foreign\_key =\> “study\_fk”  
has\_many :xml\_genes

I did the follow query:

@instances = Instance.find(:all, :include =\> [:serie,  
{:serie=\>:study}])

but the query is so slow. I want to try do the query manually, with  
the option :joins. How do I do this query, exactly, the  
parameter :joins?

Thanks in advance!
