我具有json
类型的rest_name属性,并且我在其中存储了json
种语言,例如{"de": "abc", "en": "abc"......}
但是当我创建新记录时,它会像json
那样存储整个记录
{"en": {"de": "abc", "en": "abc"......}}
在我写的模型中,
extend Mobility
translates :restaurant_name_translations, type: :string, fallbacks: {fr: :en, de: :en, es: :en, nl: :en, sv: :en, tr: :en, zh: :en, "en-GB": :en, "de-DE": :en, "fr-FR": :en, "es-ES": :en, "nl-NL": :en, "sv-SE": :en, "tr-TR": :en, "zh-Hans": :en}
# I want only to store like {"de": "abc", "en": "abc"......} in database