Sha256: 4c421f82f0397de39d10ecbe340daf7634f727d1acd44f2c12942cdec459dbaf
Contents?: true
Size: 685 Bytes
Versions: 51
Compression:
Stored size: 685 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| 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
51 entries across 51 versions & 1 rubygems