aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/migrations.textile
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2011-08-03 19:13:12 +0530
committerXavier Noria <fxn@hashref.com>2011-08-13 16:22:14 -0700
commit688b0c318f411a65bb2e27614dd9fe004427a344 (patch)
tree77b1eec944cc0bbcd96f8ac2c5635cd7790b1874 /railties/guides/source/migrations.textile
parent5adb90a14f3fc3441a53476dd75217d1ecb8de97 (diff)
downloadrails-688b0c318f411a65bb2e27614dd9fe004427a344.tar.gz
rails-688b0c318f411a65bb2e27614dd9fe004427a344.tar.bz2
rails-688b0c318f411a65bb2e27614dd9fe004427a344.zip
minor changes in migrations guide
Diffstat (limited to 'railties/guides/source/migrations.textile')
-rw-r--r--railties/guides/source/migrations.textile8
1 files changed, 4 insertions, 4 deletions
diff --git a/railties/guides/source/migrations.textile b/railties/guides/source/migrations.textile
index 7b501807d6..4476e067a6 100644
--- a/railties/guides/source/migrations.textile
+++ b/railties/guides/source/migrations.textile
@@ -540,7 +540,7 @@ end
# app/model/product.rb
class Product < ActiveRecord::Base
- validates_presence_of :flag
+ validates :flag, :presence => true
end
</ruby>
@@ -561,8 +561,7 @@ end
# app/model/product.rb
class Product < ActiveRecord::Base
- validates_presence_of :flag
- validates_presence_of :fuzz
+ validates :flag, :fuzz, :presence => true
end
</ruby>
@@ -594,9 +593,10 @@ If Alice had done this instead, there would have been no problem:
class AddFlagToProduct < ActiveRecord::Migration
class Product < ActiveRecord::Base
end
+
def change
add_column :products, :flag, :int
- Product.reset_column_information
+ Product.reset_column_information
Product.all.each { |f| f.update_attributes!(:flag => false) }
end
end