# Ror tipis - 1

**URL:** <https://www.ruby-forum.com/t/ror-tipis-1/122722>\
**Category:** Rails\
**Created:** [December 11, 2007, 9:23am UTC](https://www.ruby-forum.com/t/ror-tipis-1/122722 "2007-12-11T09:23:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [December 11, 2007, 9:23am UTC](https://www.ruby-forum.com/t/ror-tipis-1/122722/1 "2007-12-11T09:23:23Z")

</div>

@workflow\_task = WorkflowTask.find(params[:id])  
@workflow = @workflow\_task.workflow

Is there any issue in the above code? Yes. There are two DB hits in the  
above statement. First one is WorkflowTask.find(params[:id]).  
Second one is @workflow\_task.workflow.

We can reduce this two one DB hit using :include like following:

@workflow\_task = WorkflowTask.find(params[:id], :include =\> [:wofklow]  
@workflow = @workflow\_task.workflow

The RAILS will do the JOIN.

Just wanted to share with everyone since the ROR new commers might not  
aware of this.

---

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [December 11, 2007, 9:24am UTC](https://www.ruby-forum.com/t/ror-tipis-1/122722/2 "2007-12-11T09:24:21Z")

</div>

Sorry for the typo error in the subject
