Ruby on rails Globalize3-尝试向现有模型添加翻译时发生迁移错误
我正试图使用Globalize3作为一种简单的方式来提供对名为EventCategory的模型的翻译 不幸的是,当我通过rake db:migrate运行迁移时,出现以下错误:Ruby on rails Globalize3-尝试向现有模型添加翻译时发生迁移错误,ruby-on-rails,internationalization,ruby-on-rails-3.2,globalize3,Ruby On Rails,Internationalization,Ruby On Rails 3.2,Globalize3,我正试图使用Globalize3作为一种简单的方式来提供对名为EventCategory的模型的翻译 不幸的是,当我通过rake db:migrate运行迁移时,出现以下错误: == AddTranslationsToEventCategory: migrating ================================= rake aborted! An error has occurred, this and all later migrations canceled: PG:
== AddTranslationsToEventCategory: migrating =================================
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::Error: ERROR: relation "translations" does not exist
LINE 4: WHERE a.attrelid = '"translations"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"translations"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
我已经开始在谷歌上搜索解决方案,并发现:
但对我来说不起作用
以下是我的迁移:
class AddTranslationsToEventCategory < ActiveRecord::Migration
def self.up
EventCategory.create_translation_table!({
:name => :string
}, {
:migrate_data => true
})
end
def self.down
EventCategory.drop_translation_table! :migrate_data => true
end
end
class AddTranslationsToEventCategory:字符串
}, {
:migrate_data=>true
})
结束
def自动关闭
EventCategory.drop\u translation\u table!:迁移_数据=>true
结束
结束
到目前为止还没有什么棘手的事情!我不明白为什么它不起作用
我正在运行Mountain Lion的MacBookPro上使用Rails 3.2.8。Postgres是数据库系统。我已将我的应用程序提交到GitHub。请在这里找到:
如果你需要更多信息,请告诉我
提前谢谢
干杯
Lionel在GitHub上提交了这个问题后,我终于得到了帮助,这个问题在Globalize3的0.3.0版本中得到了修复。因此,解决方案只需卸载gemfile并使用以下工具进行编辑:
gem 'globalize3', '>= 0.3.0'
希望这有帮助