Ruby on rails 4 rake db:migrate在globalize gem和rails 4.1.7中失败
我正在尝试将GlobalizeGem与Rails 4.1.7结合使用。 使用最新的RVM版本,操作系统是Ubuntu 12.04,db是postgresql 9.3 按照github上readme.md中的说明,我在模型中添加了translates指令,并构建了迁移框架Ruby on rails 4 rake db:migrate在globalize gem和rails 4.1.7中失败,ruby-on-rails-4,rails-activerecord,pg,globalize,Ruby On Rails 4,Rails Activerecord,Pg,Globalize,我正在尝试将GlobalizeGem与Rails 4.1.7结合使用。 使用最新的RVM版本,操作系统是Ubuntu 12.04,db是postgresql 9.3 按照github上readme.md中的说明,我在模型中添加了translates指令,并构建了迁移框架 class Ingredient < ActiveRecord::Base translates :name, :description end class CreateIngredientTranslation
class Ingredient < ActiveRecord::Base
translates :name, :description
end
class CreateIngredientTranslations < ActiveRecord::Migration
def up
Ingredient.create.translation_table!({
name: :string,
descripion: :text
}, {
migrate_data: true
})
end
def down
Ingredient.drop_translation_table! migrate_data: true
end
end
这真的很奇怪。
在谷歌上搜索这种错误,我在github中找到了一张罚单
2013年12月开业,但仍未关闭,这似乎非常相似;唯一的解决方案似乎是对全球化代码进行黑客攻击,但我不希望在这一级别对代码进行修补。
这是因为postgres和globalize的结合,还是有其他解决方案 修复错误的迁移,例如:配料。创建翻译表!
PG::UndefinedTable: ERROR: relation "ingredient_translations" does not exsist
LINE 5: WHERE a.attrelid = '"ingredient_translations"...
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"ingredient_translations"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
/home/kranz/.rvm/gems/ruby-2.1.4@recipes/gems/activerecord-4.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `async_exec'