From 9053c4c83e4ff74e71b7e771a0b58a3cb45e53bc Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 8 Sep 2005 17:49:31 +0000 Subject: Added documentation for #1904 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2157 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/migration.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 5bfa00c19a..6f9b0ee2b4 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -120,6 +120,21 @@ module ActiveRecord # execute "ALTER TABLE `pages_linked_pages` DROP INDEX `page_id_linked_page_id`" # end # end + # + # == Using the class after changing table + # + # Some times you'll want to add a column in a migration and populate it immediately after. In that case, you'll need + # to make a call to Base#reset_column_information in order to ensure that the class has the latest column data from + # after the new column was added. Example: + # + # class MakeJoinUnique < ActiveRecord::Migration + # def self.up + # add_column :people, :salary, :integer + # Person.find(:all).each do |p| + # p.salary = SalaryCalculator.compute(p) + # end + # end + # end class Migration class << self def up() end -- cgit v1.2.3