Composed_of automatically instantiated with include?

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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs