Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8992 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

[PATCH] change belongs_to foreign key inference and remove deprecation notice

Reported by: hasmanyjosh Assigned to: core
Priority: normal Milestone: 1.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: deprecation belongs_to foreign_key
Cc:

Description

This patch completes the change begun in [4992]. When a belongs_to association is not named after the class it references, the foreign key will now be based on the association name rather than the class name. The :foreign_key option will still override the inferred name.

This looks like a small change, and all tests pass, including all the ones I could think to add. (There weren't any tests specifically for the inferred foreign key before.) However, this is the kind of change that is fundamental to a lot of things, so it should have a long bake time to make sure it doesn't mess anything up.

Attachments

infer_foreign_key_name_from_assoc_name_not_class.diff (3.1 kB) - added by hasmanyjosh on 07/15/07 20:10:50.
infer foreign key change, remove deprecation

Change History

07/15/07 20:10:50 changed by hasmanyjosh

  • attachment infer_foreign_key_name_from_assoc_name_not_class.diff added.

infer foreign key change, remove deprecation

07/16/07 20:21:40 changed by rick

  • status changed from new to closed.
  • resolution set to fixed.

(In [7188]) Change belongs_to so that the foreign_key assumption is taken from the association name, not the class name. Closes #8992 [hasmanyjosh]