From 72822800d58af8352072364aa1071fe4b8ae6702 Mon Sep 17 00:00:00 2001
From: Prem Sichanugrist <s@sikachu.com>
Date: Tue, 26 Apr 2011 23:30:08 +0700
Subject: Update guide to use `change` method in various places after migration
 generator has changed.

---
 railties/guides/source/association_basics.textile | 31 ++++-------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

(limited to 'railties/guides/source/association_basics.textile')

diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile
index e5b8c73c43..94dce1b97b 100644
--- a/railties/guides/source/association_basics.textile
+++ b/railties/guides/source/association_basics.textile
@@ -229,7 +229,7 @@ The corresponding migration might look like this:
 
 <ruby>
 class CreateSuppliers < ActiveRecord::Migration
-  def self.up
+  def change
     create_table :suppliers do |t|
       t.string  :name
       t.timestamps
@@ -241,11 +241,6 @@ class CreateSuppliers < ActiveRecord::Migration
       t.timestamps
     end
   end
-
-  def self.down
-    drop_table :accounts
-    drop_table :suppliers
-  end
 end
 </ruby>
 
@@ -314,7 +309,7 @@ If you have an instance of the +Picture+ model, you can get to its parent via +@
 
 <ruby>
 class CreatePictures < ActiveRecord::Migration
-  def self.up
+  def change
     create_table :pictures do |t|
       t.string  :name
       t.integer :imageable_id
@@ -322,10 +317,6 @@ class CreatePictures < ActiveRecord::Migration
       t.timestamps
     end
   end
-
-  def self.down
-    drop_table :pictures
-  end
 end
 </ruby>
 
@@ -333,17 +324,13 @@ This migration can be simplified by using the +t.references+ form:
 
 <ruby>
 class CreatePictures < ActiveRecord::Migration
-  def self.up
+  def change
     create_table :pictures do |t|
       t.string :name
       t.references :imageable, :polymorphic => true
       t.timestamps
     end
   end
-
-  def self.down
-    drop_table :pictures
-  end
 end
 </ruby>
 
@@ -413,17 +400,13 @@ This declaration needs to be backed up by the proper foreign key declaration on
 
 <ruby>
 class CreateOrders < ActiveRecord::Migration
-  def self.up
+  def change
     create_table :orders do |t|
       t.datetime :order_date
       t.string   :order_number
       t.integer  :customer_id
     end
   end
-
-  def self.down
-    drop_table :orders
-  end
 end
 </ruby>
 
@@ -451,16 +434,12 @@ These need to be backed up by a migration to create the +assemblies_parts+ table
 
 <ruby>
 class CreateAssemblyPartJoinTable < ActiveRecord::Migration
-  def self.up
+  def change
     create_table :assemblies_parts, :id => false do |t|
       t.integer :assembly_id
       t.integer :part_id
     end
   end
-
-  def self.down
-    drop_table :assemblies_parts
-  end
 end
 </ruby>
 
-- 
cgit v1.2.3

