Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Changeset [a9bed985cfd7d1ae93f475542bb878aa939e1c1e] by Jon Leighton

Revision a9bed985cfd7d1ae93f475542bb878aa939e1c1e, committed 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...

4 changed files

  • 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