我在Rails 4中創建了一個可安裝的引擎。 我正在用虛擬測試應用程序測試它。發電機在軌道中4
我創造了我安裝發電機
'的lib/myenginename /安裝/ 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 ...
如何爲發動機工作制造發電機?