Sha256: b642be6ef1f16939ece1722a0e21bd61296a4b97a5a4994aac16251781bf931a
Contents?: true
Size: 576 Bytes
Versions: 31
Compression:
Stored size: 576 Bytes
Contents
module Enjoy::ModelLocalizeable extend ActiveSupport::Concern module ClassMethods def convert2localize self.all.to_a.map do |p| p.convert2localize end end end def convert2localize arr = {} self.localized_fields.keys.each do |f| next if self[f].is_a?(Hash) arr[f] = self.remove_attribute(f) self[f] = {} end self.save I18n.available_locales.each do |l| I18n.with_locale(l) do arr.each_pair do |f, v| self.send(f + "=", v) end end end self.save end end
Version data entries
31 entries across 31 versions & 1 rubygems