aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRohit Paul Kuruvilla <rohitpaul@iitrpr.ac.in>2014-01-21 23:07:18 +0530
committerRohit Paul Kuruvilla <rohitpaul@iitrpr.ac.in>2014-01-31 11:31:19 +0530
commit464d47eaaf76995ae8eaa5205d250ff859fed795 (patch)
tree1e4e146f37cf58e5ee4cd79ebdef3ad7302304d5
parentb0a8ef140e4cc95fa5d3888699fd3d72fd720172 (diff)
downloadrails-464d47eaaf76995ae8eaa5205d250ff859fed795.tar.gz
rails-464d47eaaf76995ae8eaa5205d250ff859fed795.tar.bz2
rails-464d47eaaf76995ae8eaa5205d250ff859fed795.zip
Updated association_basics.md [ci skip]
Updated association_basics.md to include how to write migrations for self joins Update association_basics.md Corrected the update Update association_basics.md Typo fix Changed :employee to :manager
-rw-r--r--guides/source/association_basics.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index 9867d2dc3f..5ec6ae0f21 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -490,6 +490,19 @@ end
With this setup, you can retrieve `@employee.subordinates` and `@employee.manager`.
+In your migrations/schema, you will add a references column to the model itself.
+
+```ruby
+class CreateEmployees < ActiveRecord::Migration
+ def change
+ create_table :employees do |t|
+ t.references :manager
+ t.timestamps
+ end
+ end
+end
+```
+
Tips, Tricks, and Warnings
--------------------------