When I used this code
Rails::Generators.invoke("active_record:migration","create_tests",{:behavior=>:invoke, :destination_root=>Rails.root})
to generate migration file, I got the following class generated:
class CreateTests < ActiveRecord::Migration
def up
end
def down
end
end
But what I want is this:
class CreateTests < ActiveRecord::Migration
def change
create_table :tests do |t|
t.timestamps
end
end
end
I'm not aware of what parameters I need to pass inside the invoke method.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…