Skip to content

Commit

Permalink
minor changes in migrations guide
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaydev authored and fxn committed Aug 4, 2011
1 parent b3719ee commit febdd6c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions railties/guides/source/migrations.textile
Expand Up @@ -540,7 +540,7 @@ end
# app/model/product.rb

class Product < ActiveRecord::Base
validates_presence_of :flag
validates :flag, :presence => true
end
</ruby>

Expand All @@ -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>

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit febdd6c

Please sign in to comment.