在我的 rails3 应用程序中,我通过命令“rails plugin installacts_as_taggable_on_steroids”安装了acts_as_taggable_on_steroids 并安装了它,但现在迁移给了我问题。
我运行“rails generateacts_as_taggable_migration”,但错误出现“找不到生成器acts_as_taggable_migration”,请帮忙
在我的 rails3 应用程序中,我通过命令“rails plugin installacts_as_taggable_on_steroids”安装了acts_as_taggable_on_steroids 并安装了它,但现在迁移给了我问题。
我运行“rails generateacts_as_taggable_migration”,但错误出现“找不到生成器acts_as_taggable_migration”,请帮忙
设法通过 3 个步骤找出解决方法:
1)$ rails generate migration acts_as_taggable
invoke active_record
create db/migrate/20110710214842_acts_as_taggable.rb
2) 用迁移信息覆盖
$ cat lib/ruby/gems/1.8/gems/acts_as_taggable_on_steroids-1.2/generators/acts_as_taggable_migration/templates/migration.rb > 20110710223844_acts_as_taggable_migration.rb
3) 迁移
$ rake db:migrate
(in c:/Sites/bon)
== ActsAsTaggable: migrating =================================================
== ActsAsTaggable: migrated (0.0000s) ========================================
== ActsAsTaggableMigration: migrating ========================================
-- create_table(:tags)
-> 0.0020s
-- create_table(:taggings)
-> 0.0010s
-- add_index(:taggings, :tag_id)
-> 0.0010s
-- add_index(:taggings, [:taggable_id, :taggable_type])
-> 0.0010s
== ActsAsTaggableMigration: migrated (0.0140s) ===============================
验证$ rake db:migration:status
最新版本的 rails (3.0 +) 的安装迁移注释已更改:
# For the latest versions :
rake acts_as_taggable_on_engine:install:migrations
这解决了我的问题,与上面的问题相同。
rails generate migration acts_as_taggable
rake acts_as_taggable_on_engine:install:migrations
链接到 github 文档https://github.com/mbleigh/acts-as-taggable-on