在我的 rails 5 引擎中,我想将引擎迁移的安装与我在以下位置的自定义安装生成器一起安装:
myengine/lib/generators/myengine/install_generator.rb
这个生成器目前看起来像这样:
module Myengine
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path("../../templates", __FILE__)
desc "Creates a Myengine initializer and copys template files to your application."
def copy_initializer
template "myengine.rb", "config/initializers/myengine.rb"
end
end
end
end
当我将引擎添加到 rails 应用程序时,不必调用:
rails g myengine:install
然后
rails myengine:install:migrations
如何将这些迁移的创建添加到自定义生成器?