module Para::I18n::AttributeTranslation

This module redirects the reading and writing of the translated attributes to the right attribute translation class

Public Class Methods

attribute_translation_class(locale, model, attribute) click to toggle source
# File lib/para/i18n/attribute_translation.rb, line 15
def self.attribute_translation_class(locale, model, attribute)
  attribute_translation_class = if AttributeTranslation::Attachment.matches?(model, attribute)
    AttributeTranslation::Attachment.new(locale, model, attribute)
  else
    AttributeTranslation::SimpleAttribute.new(locale, model, attribute)
  end
end
read(locale, resource, attribute) click to toggle source
# File lib/para/i18n/attribute_translation.rb, line 7
def self.read(locale, resource, attribute)
  attribute_translation_class(locale, resource.class, attribute).read(resource)
end
write(locale, resource, attribute, value) click to toggle source
# File lib/para/i18n/attribute_translation.rb, line 11
def self.write(locale, resource, attribute, value)
  attribute_translation_class(locale, resource.class, attribute).write(resource, value)
end