Module: Globalize::Model::ActiveRecord::Translated::InstanceMethods
- Defined in:
- lib/magic_locales/globalized_fields.rb
Instance Method Summary collapse
- #after_save ⇒ Object
-
#init_translations ⇒ Object
Builds an empty translation for each available locale not in use after creation.
Instance Method Details
#after_save ⇒ Object
32 33 34 |
# File 'lib/magic_locales/globalized_fields.rb', line 32 def after_save init_translations end |
#init_translations ⇒ Object
Builds an empty translation for each available locale not in use after creation
37 38 39 40 41 42 43 44 45 |
# 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 |