Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minor changes in migrations guide

  • Loading branch information...
commit 19eb720122d5897900b84929b418c0390bd5a32b 1 parent 8207d0c
@vijaydev vijaydev authored fxn committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 railties/guides/source/migrations.textile
View
8 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
Please sign in to comment.
Something went wrong with that request. Please try again.