RailsCasts Pro episodes are now free!

Learn more or hide this

Pau Compte's Profile

GitHub User: pauc

Comments by Pau Compte

Avatar

I have solved this same problem using a column where I store the original locale, and overriding a method set in Globalize3::ActiveRecord::InstanceMethods. Here is the code:

def globalize_fallbacks(locale)
  if record_fallback?(locale)
    [locale, original_locale]
  else
    Globalize.fallbacks(locale)
  end
end

def record_fallback?(locale)
  respond_to?("original_locale") and
    original_locale.present? and
    original_locale != locale
end

It works fine. I don't know if there is any downside...