Sha256: f76fbe3498f1ae6e0191220eee605bb0653e4837067230538e7cb9bf03a2ec6e
Contents?: true
Size: 681 Bytes
Versions: 76
Compression:
Stored size: 681 Bytes
Contents
module Lalala::ExtActiveRecord::I18nTranslationsWriter extend ActiveSupport::Concern module ClassMethods def translates(*attr_names) init = translates? result = super(*attr_names) if init include Writer attr_accessible :translations_writer end result end end module Writer def translations_writer=(attributes) _locale = I18n.locale I18n.available_locales.each do |locale| I18n.locale = locale attrs = attributes[locale.to_s] if attrs self.assign_attributes(attrs) end end attributes ensure I18n.locale = _locale end end end
Version data entries
76 entries across 76 versions & 1 rubygems