Permalink
Browse files

:foreign_key option should be on has_many side of association

  • Loading branch information...
1 parent 65a3020 commit 44ef59f40baaa1b776248727e23452b25d69fa1d @Mik-die Mik-die committed Mar 23, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 guides/source/association_basics.textile
@@ -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>

0 comments on commit 44ef59f

Please sign in to comment.