module Globalize::Missing

Constants

VERSION

Public Instance Methods

read_attribute(name, options = {}) click to toggle source
Calls superclass method
# File lib/globalize/missing.rb, line 5
def read_attribute(name, options = {})
  options = {:translated => true, :locale => nil}.merge(options)
  return super(name) unless options[:translated]

  if name == :locale
    self.try(:locale).presence || ( self.translation.locale unless self.translation.nil? )
  elsif self.class.translated?(name)
    if (value = globalize.fetch(options[:locale] || Globalize.locale, name))
      value
    else
      super(name)
    end
  else
    super(name)
  end
end
translation_for(locale, build_if_missing = false) click to toggle source
Calls superclass method
# File lib/globalize/missing.rb, line 22
def translation_for(locale, build_if_missing = false)
  super
end