3

在我的 rails3 应用程序中,我通过命令“rails plugin installacts_as_taggable_on_steroids”安装了acts_as_taggable_on_steroids 并安装了它,但现在迁移给了我问题。

我运行“rails generateacts_as_taggable_migration”,但错误出现“找不到生成器acts_as_taggable_migration”,请帮忙

4

3 回答 3

4

设法通过 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

于 2011-07-10T21:52:45.647 回答
1

最新版本的 rails (3.0 +) 的安装迁移注释已更改:

# For the latest versions :
rake acts_as_taggable_on_engine:install:migrations

在 Github 项目中作为可标记的详细信息

于 2014-03-13T12:20:50.843 回答
0

这解决了我的问题,与上面的问题相同。

rails generate migration acts_as_taggable
rake acts_as_taggable_on_engine:install:migrations

链接到 github 文档https://github.com/mbleigh/acts-as-taggable-on

于 2017-04-25T09:45:33.157 回答