aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-12-16 20:10:30 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2010-12-16 20:58:58 -0200
commit3b9120fa52b76fb8591fe1d0db85d1a940e867d0 (patch)
tree9f7a66f9bd99a31a5b69f2c06b2ff0231d02b4b0 /railties/guides/source
parentf176b2552ecc06634dae53b82a4562d8e80aeed6 (diff)
downloadrails-3b9120fa52b76fb8591fe1d0db85d1a940e867d0.tar.gz
rails-3b9120fa52b76fb8591fe1d0db85d1a940e867d0.tar.bz2
rails-3b9120fa52b76fb8591fe1d0db85d1a940e867d0.zip
Generate add_index by default when giving type belongs_to or references
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/getting_started.textile4
1 files changed, 3 insertions, 1 deletions
diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile
index 902b7353c0..e371632d87 100644
--- a/railties/guides/source/getting_started.textile
+++ b/railties/guides/source/getting_started.textile
@@ -811,6 +811,8 @@ class CreateComments < ActiveRecord::Migration
t.timestamps
end
+
+ add_index :comments, :post_id
end
def self.down
@@ -819,7 +821,7 @@ class CreateComments < ActiveRecord::Migration
end
</ruby>
-The +t.references+ line sets up a foreign key column for the association between the two models. Go ahead and run the migration:
+The +t.references+ line sets up a foreign key column for the association between the two models. And the +add_index+ line sets up an index for this association column. Go ahead and run the migration:
<shell>
$ rake db:migrate