/ Published in: Ruby
Suppose you already have a database with a table named candy and now you want to start using migrations. If you try to run a migration with a pre-existing table, Rails will error. So by placing :force => true, you are forcefully wiping the table. After you've performed your migration, you normally want to return the Boolean to false.
Expand |
Embed | Plain Text
class CreateCandy < ActiveRecord::Migration def self.up create_table :candies, :force => true do |t| t.string :name t.string :type t.timestamps end end def self.down drop_table :candies end end
You need to login to post a comment.
