1
我看到了遷移數據庫的兩種不同方式。哪一個是在Rails 3中完成的正確方法?Ruby On Rails遷移
class CreateProducts < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.string :title
t.timestamps
end
end
and
class CreateProducts < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.column :name, :string
t.timestamps
end
end
謝謝!
第一個是默認的,看你什麼時候搭腳手架 – apneadiving 2011-01-14 16:13:57
那麼第二個是什麼優點呢? – joshim5 2011-01-14 16:26:08