lundi 30 mai 2016

Is there any method in Rails that creates basic structure for migration?

For example I have the following code:

create_table "users", force: :cascade do |t|
  t.string  "name"
end

Instead of appending strings myself, I'd like to call some method that would build basic migration skeleton for it like this:

class CreateUsers < ActiveRecord::Migration
  def change
    create_table "users", force: :cascade do |t|
      t.string  "name"
    end
  end
end

Aucun commentaire:

Enregistrer un commentaire