This project is archived and is in readonly mode.

Changeset [a9bed985cfd7d1ae93f475542bb878aa939e1c1e] by Jon Leighton

January 4th, 2011 @ 12:24 AM

When preloading a belongs_to, the target should still be set (to nil) if there is no foreign key present. And the loaded flag should be set on the association proxy. This then allows us to remove the foreign_key_present? check from BelongsToAssociation#find_target. Also added a test for the same thing on polymorphic associations.
https://github.com/rails/rails/commit/a9bed985cfd7d1ae93f475542bb87...

Committed by Jon Leighton

  • M activerecord/lib/active_record/association_preload.rb
  • M activerecord/lib/active_record/associations.rb
  • M activerecord/lib/active_record/associations/belongs_to_association.rb
  • M activerecord/test/cases/associations/eager_test.rb

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>