From d3c981528340921391a69688bae4dc9670039ad6 Mon Sep 17 00:00:00 2001 From: Pedro Carmona Date: Sat, 2 Nov 2024 18:29:30 +0000 Subject: [PATCH] feature: Allow locales with region example pt-PT --- app/models/concerns/spina/translated_content.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/concerns/spina/translated_content.rb b/app/models/concerns/spina/translated_content.rb index ef3775487..ad0366608 100644 --- a/app/models/concerns/spina/translated_content.rb +++ b/app/models/concerns/spina/translated_content.rb @@ -7,14 +7,14 @@ module TranslatedContent included do # Store each locale's content in [locale]_content as an array of parts Spina.locales.each do |locale| - attr_json "#{locale}_content".to_sym, AttrJson::Type::SpinaPartsModel.new, array: true, default: -> { [] } - attr_json_setter_monkeypatch "#{locale}_content".to_sym - attr_json_accepts_nested_attributes_for "#{locale}_content".to_sym + attr_json "#{locale.to_s.underscore}_content".to_sym, AttrJson::Type::SpinaPartsModel.new, array: true, default: -> { [] } + attr_json_setter_monkeypatch "#{locale.to_s.underscore}_content".to_sym + attr_json_accepts_nested_attributes_for "#{locale.to_s.underscore}_content".to_sym end end def find_part(name) - send("#{I18n.locale}_content").find { |part| part.name.to_s == name.to_s } + send("#{I18n.locale.to_s.underscore}_content").find { |part| part.name.to_s == name.to_s } end end end