Built associations don't know their parent. Why not?

Simple example.

class Car < ActiveRecord::Base   has_one :engine

  validates_presence_of :engine   validates_associated :engine end

class Engine < ActiveRecord::Base   belongs_to :car

  validates_presence_of :car end

@car = Car.new @car.valid? # => false @car.errors # => no engine obviously

@car.build_engine @car.valid? # => false

How come??

@car.errors # => engine has no car! @car.engine.car # => nil

Since we validate_associated :engine, engine runs its own validations and finds that validates_presence_of car is false, since car is nil. Shouldn't engine know the car that built it?

Just for fun I do this:

@car.engine.car = @car @car.valid? # => true

Shouldn't this work by default?

If you have suggestions, I moved this to Core: http://groups.google.com/group/rubyonrails-core/browse_thread/thread/eaba411bb69c58d8