diff options
author | Mikhail Dieterle <MikDiet@gmail.com> | 2012-03-23 18:30:16 +0800 |
---|---|---|
committer | Erich Menge <erich.menge@me.com> | 2012-05-13 11:20:32 -0500 |
commit | 3f7ed52d3b0cdb31c355b142f9ac7526685a7049 (patch) | |
tree | aea93521dad7a0b6398da93751adeb7cda0008ac /railties/guides | |
parent | 3d0e7ad7360fa3019413b27f416586f04f531f99 (diff) | |
download | rails-3f7ed52d3b0cdb31c355b142f9ac7526685a7049.tar.gz rails-3f7ed52d3b0cdb31c355b142f9ac7526685a7049.tar.bz2 rails-3f7ed52d3b0cdb31c355b142f9ac7526685a7049.zip |
:foreign_key option should be on has_many side of association
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/association_basics.textile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index 6f0d985cac..ceb4862ff5 100644 --- a/railties/guides/source/association_basics.textile +++ b/railties/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> |