【发布时间】:2015-04-03 20:37:55
【问题描述】:
我在 Rails 4 中创建了一个可挂载引擎。 我正在使用虚拟测试应用程序对其进行测试。
我在
中创建了我的安装生成器'lib/myenginename/install/install_generator.rb':
require 'rails/generators/active_record'
require 'rails/generators/migration'
module Myengine
module Generators
class MyengineGenerator < Rails::Generators::Base
desc "Installs mygem and generates the necessary migrations"
source_root File.expand_path("../templates", __FILE__)
def create_migrations
migration_template 'migrations/m1.rb', 'db/migrate/m1.rb'
end
end
end
end
但是当我跑步时
rails g myengine:install
显示错误:
Could not find generator 'myengine:install'. Maybe you meant ...
如何使发电机发电机工作?
【问题讨论】:
标签: ruby-on-rails