Module: Trendi18n::Handler

Defined in:
lib/trendi18n/handler.rb

Class Method Summary collapse

Class Method Details

.included(subclass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/trendi18n/handler.rb', line 4

def self.included(subclass)
  subclass.class_eval do
    before_filter :translations_cache_updater

    # check translations cache up-to-date status and reload backend or/and locales when needed
    def translations_cache_updater
      I18n.backend.reload! unless I18n.backend.up_to_date?
      I18n.backend.locales_reload! unless I18n.backend.locales_up_to_date?
    end
  end
end