diff options
author | Mikhail Dieterle <MikDiet@gmail.com> | 2012-03-23 18:30:16 +0800 |
---|---|---|
committer | Mikhail Dieterle <MikDiet@gmail.com> | 2012-03-23 18:30:16 +0800 |
commit | 44ef59f40baaa1b776248727e23452b25d69fa1d (patch) | |
tree | 5377c33381cf2127155a2dfaaa4005918ceeab3c /guides/source/association_basics.textile | |
parent | 65a3020851f235cac88afa215b805c2ed43f2639 (diff) | |
download | rails-44ef59f40baaa1b776248727e23452b25d69fa1d.tar.gz rails-44ef59f40baaa1b776248727e23452b25d69fa1d.tar.bz2 rails-44ef59f40baaa1b776248727e23452b25d69fa1d.zip |
:foreign_key option should be on has_many side of association
Diffstat (limited to 'guides/source/association_basics.textile')
-rw-r--r-- | guides/source/association_basics.textile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/association_basics.textile b/guides/source/association_basics.textile index 493b7c30be..8ddc56bef1 100644 --- a/guides/source/association_basics.textile +++ b/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> |