From febdd6c96c827b8faee22ba9d15c1d943a70a6d3 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 3 Aug 2011 19:13:12 +0530 Subject: minor changes in migrations guide --- railties/guides/source/migrations.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'railties') 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 @@ -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 @@ -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 -- cgit v1.2.3