Sha256: 77b75c3ea510a0304b1e8c4033d9af309f8ce811c1bacd115c7cdcbcbb096665
Contents?: true
Size: 778 Bytes
Versions: 60
Compression:
Stored size: 778 Bytes
Contents
module Lalala::ExtActiveRecord::I18nTranslationsWriter extend ActiveSupport::Concern module ClassMethods def translates(*attr_names) init = translates? result = super(*attr_names) unless 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| next if Rails.application.config.lalala.i18n.excluded_locales.try(:include?, 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
60 entries across 60 versions & 1 rubygems