diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-12-16 20:10:30 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-12-16 20:58:58 -0200 |
commit | 3b9120fa52b76fb8591fe1d0db85d1a940e867d0 (patch) | |
tree | 9f7a66f9bd99a31a5b69f2c06b2ff0231d02b4b0 /activerecord/CHANGELOG | |
parent | f176b2552ecc06634dae53b82a4562d8e80aeed6 (diff) | |
download | rails-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 'activerecord/CHANGELOG')
-rw-r--r-- | activerecord/CHANGELOG | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 9c2e311c75..056de18cde 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,27 @@ *Rails 3.1.0 (unreleased)* +* When a model is generated add_index is added by default for belongs_to or references columns + + rails g model post user:belongs_to will generate the following: + + class CreatePosts < ActiveRecord::Migration + def up + create_table :posts do |t| + t.belongs_to :user + + t.timestamps + end + + add_index :posts, :user_id + end + + def down + drop_table :posts + end + end + + [Santiago Pastorino] + * Setting the id of a belongs_to object will update the reference to the object. [#2989 state:resolved] |