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

Public Instance Methods

after_save() click to toggle source
# File lib/models/model.rb, line 11
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/models/model.rb, line 16
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