Sha256: 72f3f581e01227ca9a6b110fe2ef3ac383355dceccf74893325aacae960197b3
Contents?: true
Size: 573 Bytes
Versions: 1
Compression:
Stored size: 573 Bytes
Contents
module LostInTranslations module ActiveRecord module ClassMethods def translate(*fields) LostInTranslations.define_translation_methods(self, *fields) end end def self.included(base_class) base_class.include Base base_class.extend ClassMethods end def translate(field, locale = I18n.locale) LostInTranslations.translate(self, field, locale) || ActiveRecord.call_original_field(self, field) end def self.call_original_field(object, field) object.read_attribute(field) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lost_in_translations-1.2.0 | lib/lost_in_translations/active_record.rb |