1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

:foreign_key option should be on has_many side of association

This commit is contained in:
Mikhail Dieterle 2012-03-23 18:30:16 +08:00
parent 65a3020851
commit 44ef59f40b

View file

@ -342,9 +342,9 @@ In designing a data model, you will sometimes find a model that should have a re
<ruby>
class Employee < ActiveRecord::Base
has_many :subordinates, :class_name => "Employee"
belongs_to :manager, :class_name => "Employee",
has_many :subordinates, :class_name => "Employee",
:foreign_key => "manager_id"
belongs_to :manager, :class_name => "Employee"
end
</ruby>