Sha256: a332c80112ea2e18e91fba05f02bb2bc620d2e0bfcd0572bde1b0412bf8a6a83
Contents?: true
Size: 554 Bytes
Versions: 5
Compression:
Stored size: 554 Bytes
Contents
module Spina module TranslatedContent extend ActiveSupport::Concern included do # Store each locale's content in [locale]_content as an array of parts Spina.config.locales.each do |locale| attr_json "#{locale}_content".to_sym, AttrJson::Type::SpinaPartsModel.new, array: true, default: -> { [] } attr_json_accepts_nested_attributes_for "#{locale}_content".to_sym end def find_part(name) send("#{I18n.locale}_content").find{|part| part.name.to_s == name.to_s} end end end end
Version data entries
5 entries across 5 versions & 1 rubygems