如何使用 Mobility 在 Rails 应用程序中为模型翻译设置固定装置?
目前,我有以下目录结构:
test
fixtures
article
translations.yml
articles.yml
# test/fixtures/articles.yml
past_article:
type: BlogPost
author: Barney Rubble
posted_on: <%= 5.days.ago.to_s(:db) %>
hero_image_id: 1
# test/fixtures/article/translations.yml
past_article_translation:
article: past_article
locale: en
title: Past Article Fixture
subtitle: Temporary subtitle
body: This is the temporary blog post content.
我ActiveRecord::Fixture::FixtureError: table "article_translations" has no column named "article".
在尝试运行测试时得到。
使用 Globalize gem,我可以将密钥translations.yml
从更改article
为globalized_model
,但这不适用于 Mobility。