aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikachu.com>2011-04-26 23:33:39 +0700
committerPrem Sichanugrist <s@sikachu.com>2011-04-26 23:33:39 +0700
commitd4259d8932c9fe4128bd4b0876f9e48085035032 (patch)
tree8ae961332c13512a251e88d379dc0f2d198440d3 /railties
parent72822800d58af8352072364aa1071fe4b8ae6702 (diff)
downloadrails-d4259d8932c9fe4128bd4b0876f9e48085035032.tar.gz
rails-d4259d8932c9fe4128bd4b0876f9e48085035032.tar.bz2
rails-d4259d8932c9fe4128bd4b0876f9e48085035032.zip
Change from `self.(up|down)` to `(up|down)` method
Diffstat (limited to 'railties')
-rw-r--r--railties/guides/source/getting_started.textile2
-rw-r--r--railties/guides/source/migrations.textile16
2 files changed, 9 insertions, 9 deletions
diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile
index 63bb38318c..a826a33120 100644
--- a/railties/guides/source/getting_started.textile
+++ b/railties/guides/source/getting_started.textile
@@ -1450,7 +1450,7 @@ Two very common sources of data that are not UTF-8:
h3. Changelog
-* April 26, 2011: Changed migration code from +self.up+, +self.down+ pair to +change+ method "Prem Sichanugrist":"http://sikachu.com"
+* April 26, 2011: Changed migration code from +up+, +down+ pair to +change+ method "Prem Sichanugrist":"http://sikachu.com"
* April 11, 2011: Changed scaffold_controller generator to create format block for JSON instead of XML "Sebastian Martinez":http://www.wyeworks.com
* August 30, 2010: Minor editing after Rails 3 release by "Joost Baaij":http://www.spacebabies.nl
* July 12, 2010: Fixes, editing and updating of code samples by "Jaime Iniesta":http://jaimeiniesta.com
diff --git a/railties/guides/source/migrations.textile b/railties/guides/source/migrations.textile
index 238fe3603b..39f8a458a0 100644
--- a/railties/guides/source/migrations.textile
+++ b/railties/guides/source/migrations.textile
@@ -21,7 +21,7 @@ Before I dive into the details of a migration, here are a few examples of the so
<ruby>
class CreateProducts < ActiveRecord::Migration
- def self.up
+ def up
create_table :products do |t|
t.string :name
t.text :description
@@ -30,7 +30,7 @@ class CreateProducts < ActiveRecord::Migration
end
end
- def self.down
+ def down
drop_table :products
end
end
@@ -42,14 +42,14 @@ Migrations are not limited to changing the schema. You can also use them to fix
<ruby>
class AddReceiveNewsletterToUsers < ActiveRecord::Migration
- def self.up
+ def up
change_table :users do |t|
t.boolean :receive_newsletter, :default => false
end
User.update_all ["receive_newsletter = ?", true]
end
- def self.down
+ def down
remove_column :users, :receive_newsletter
end
end
@@ -190,11 +190,11 @@ generates
<ruby>
class RemovePartNumberFromProducts < ActiveRecord::Migration
- def self.up
+ def up
remove_column :products, :part_number
end
- def self.down
+ def down
add_column :products, :part_number, :string
end
end
@@ -358,7 +358,7 @@ The +down+ method of your migration should revert the transformations done by th
<ruby>
class ExampleMigration < ActiveRecord::Migration
- def self.up
+ def up
create_table :products do |t|
t.references :category
end
@@ -375,7 +375,7 @@ class ExampleMigration < ActiveRecord::Migration
rename_column :users, :email, :email_address
end
- def self.down
+ def down
rename_column :users, :email_address, :email
remove_column :users, :home_page_url
execute "ALTER TABLE products DROP FOREIGN KEY fk_products_categories"