简体   繁体   English

如何在红宝石宝石中创建Rails迁移生成器?

[英]How do you create a rails migration generator in a ruby gem?

Im creating a simple Rails 2.3.8 gem and need a migration file inside it. 我创建了一个简单的Rails 2.3.8 gem,并且需要一个迁移文件。 I following this structure: 我遵循以下结构:

/
/generators
/generators/conductor_migration
/generators/conductor_migration/conductor_migration_generator.rb
/generators/conductor_migration/templates
/generators/conductor_migration/templates/conductor_migration.rb

but when I install the gem in my app and run script/generate conductor_migration i says it cant find the migration. 但是当我在应用程序中安装gem并运行脚本/生成导体时,我说它找不到迁移。

Any thoughts? 有什么想法吗?

Turns out it's a bug in bundler for 2.3.8. 原来这是2.3.8捆绑程序中的错误。 I received a note from them yesterday saying that you can't access generators in gems that are local with bundler in 2.3.X you need to install them from the server. 昨天我收到他们的来信,说您无法使用2.3.X中的bundler在本地的gems中访问生成器,需要从服务器安装它们。 Lovely. 可爱。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM