我正在使用Rails 3.0.6/Ruby 1.8.7,我一直試圖讓acts_as_taggable_on(2.0.6)gem工作,但它似乎在默認遷移時失敗。 日誌:Acts_as_taggable_on遷移失敗
== ActsAsTaggableOnMigration: migrating ======================================
-- create_table(:tags)
-> 0.3175s
-- create_table(:taggings)
rake aborted!
An error has occurred, all later migrations canceled:
Mysql2::Error: Can't create table 'project_development.taggings' (errno: 150):
CREATE TABLE `taggings` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY,
`tag_id` int(11), `taggable_id` int(11), `taggable_type` varchar(255), `tagger_id`
int(11), `tagger_type` varchar(255), `context` varchar(255), `created_at` datetime,
FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`), FOREIGN KEY (`taggable_id`) REFERENCES
`taggables` (`id`), FOREIGN KEY (`tagger_id`) REFERENCES `taggers` (`id`)) ENGINE=InnoDB
所以它看起來像多態=> true屬性並不像預期的那樣。谷歌似乎不是很有幫助(類似的錯誤報告,例如http://www.ruby-forum.com/topic/194219)。任何方式來解決它?寶石的替代品?
解決 這種寶石
那麼你是怎麼解決的呢?你停止使用automatic_foreign_key了嗎? – andrewdotnich 2011-12-15 03:28:38