Decrease SELECT queries count; has_[joined_table_name]?

I execute a query with several :includes in it.
For example, let’s say I use

test = ModelClassName.find( id, :include => [ :table_1, :table_2 ])

Now test has methods called has_table_1? and has_table_2?

If joined table_1 is not nil for this result (i.e. test.has_table_1? ==
true)
I can simply get all attributes of table_1 using
test.table_1.[attribute_name]
and this wouldn’t cause additional databse query;

But if test.has_table_1? == false, or, the same, test.table_1 == nil;
calling of this methods (has_table_1? or test.table_1 == nil) creates
additional query: SELECT * FROM table_1 WHERE (table_1.id = …)

So the question is: how to change this behaviour to avoid additional
query?

Thanks

Caching of nil has_one associations has recently been added to trunk and
will be in 1.2. You can run edge if you want to try it out.

-Jonathan.

Jonathan V. wrote:

Caching of nil has_one associations has recently been added to trunk and
will be in 1.2. You can run edge if you want to try it out.

-Jonathan.

And what is the supposed date of 1.2 release?

Also what about caching of nil belong_to associations?

Dmitry H. wrote:

Jonathan V. wrote:

Caching of nil has_one associations has recently been added to trunk and
will be in 1.2. You can run edge if you want to try it out.

-Jonathan.

And what is the supposed date of 1.2 release?