module Globalize::Model::ActiveRecord::Translated::InstanceMethods

Public Instance Methods

after_save() click to toggle source
# File lib/magic_locales/globalized_fields.rb, line 32
def after_save
  init_translations
end
init_translations() click to toggle source

Builds an empty translation for each available locale not in use after creation

# File lib/magic_locales/globalized_fields.rb, line 37
def init_translations
  I18n.translated_locales.reject{|key| key == :root }.each do |locale|
    translation = self.translations.find_by_locale locale.to_s
    if translation.nil?
      translations.build :locale => locale
      save
    end
  end
end