Skip to content
This repository
Browse code

minor changes in migrations guide

  • Loading branch information...
commit febdd6c96c827b8faee22ba9d15c1d943a70a6d3 1 parent b3719ee
Vijay Dev authored August 03, 2011 fxn committed August 04, 2011

Showing 1 changed file with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. 8  railties/guides/source/migrations.textile
8  railties/guides/source/migrations.textile
Source Rendered
@@ -540,7 +540,7 @@ end
540 540
 # app/model/product.rb
541 541
 
542 542
 class Product < ActiveRecord::Base
543  
-  validates_presence_of :flag
  543
+  validates :flag, :presence => true
544 544
 end
545 545
 </ruby>
546 546
 
@@ -561,8 +561,7 @@ end
561 561
 # app/model/product.rb
562 562
 
563 563
 class Product < ActiveRecord::Base
564  
-  validates_presence_of :flag
565  
-  validates_presence_of :fuzz
  564
+  validates :flag, :fuzz, :presence => true
566 565
 end
567 566
 </ruby>
568 567
 
@@ -594,9 +593,10 @@ If Alice had done this instead, there would have been no problem:
594 593
 class AddFlagToProduct < ActiveRecord::Migration
595 594
   class Product < ActiveRecord::Base
596 595
   end
  596
+
597 597
   def change
598 598
     add_column :products, :flag, :int
599  
-    Product.reset_column_information  
  599
+    Product.reset_column_information
600 600
     Product.all.each { |f| f.update_attributes!(:flag => false) }
601 601
   end
602 602
 end

0 notes on commit febdd6c

Please sign in to comment.
Something went wrong with that request. Please try again.