has_one/belongs_to -- accessing the subordinate

With a has_one/belongs_to relationship, what's the best way to guarantee
that the belongs_to object gets created and is accessible alongside the
has_one object? I *think* the after_create callback is a good choice,
but I discovered an oddity while trying it.

F'rinstance, if every horse has a carriage:

ActiveRecord does query caching by default.
If you use build instead of new when creating the child object the
problem is solved, at least for has_many associations. I have no idea
if this works with has_one associations.

Example of what I mean:

@user = User.new(:name => 'bob')

=> #<User id: nil, name: "bob", age: nil, created_at: nil, updated_at:


=> []

@user.comments.build(:body => 'my comment')

=> #<Comment id: nil, user_id: nil, body: "my comment", created_at:
nil, updated_at: nil>


=> true


=> [#<Comment id: 2, user_id: 3, body: "my comment", created_at:
"2010-05-12 08:57:21", updated_at: "2010-05-12 08:57:21">]

Replace build with new, and @user.comments will still return [] after
@user has been saved.