# Composed\_of automatically instantiated with include?

**URL:** <https://www.ruby-forum.com/t/composed-of-automatically-instantiated-with-include/117013>\
**Category:** Rails\
**Created:** [October 12, 2007, 2:17am UTC](https://www.ruby-forum.com/t/composed-of-automatically-instantiated-with-include/117013 "2007-10-12T02:17:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [October 12, 2007, 2:17am UTC](https://www.ruby-forum.com/t/composed-of-automatically-instantiated-with-include/117013/1 "2007-10-12T02:17:07Z")

</div>

Im currently using composed\_of in many places in my AR models where I  
don’t want to do a has\_one association. The problem is, is that I would  
like to model instantiated immediately when it is found. For example:

class Page \< ActiveRecord::Base

composed\_of :background, blahblahblah

end

When I call Page.find(1). I want the background object to already be  
instantiated with @background before I actually call page.background.

Is there anyway to do this. I tried Page.find(1,  
:include=\>“background”), but this isnt built in to Rails yet.

Any ideas?
