Sha256: 72c9a1adac0f9a4827f38e23afa7842ba69d37750d47add520512215fee59d51
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
require 'i18n/backend/active_record' require 'interpret/logger' require 'interpret/helpers' require 'interpret/controller_filter' module Interpret class Engine < Rails::Engine initializer "interpret.register_i18n_active_record_backend" do |app| app.config.after_initialize do if Interpret.registered_envs.include?(Rails.env.to_sym) I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize) I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten) Interpret.backend = I18n::Backend::Chain.new(I18n::Backend::ActiveRecord.new, I18n.backend) I18n.backend = Interpret.backend end end end initializer "interpret.setup_translations_logger" do |app| logfile = File.open("#{Rails.root}/log/interpret.log", 'a') logfile.sync = true Interpret.logger = InterpretLogger.new(logfile) end initializer "interpret.register_observer" do |app| app.config.before_initialize do |app| ActiveRecord::Base.observers << Interpret.sweeper.to_sym if Interpret.sweeper && I18n::Backend::ActiveRecord::Translation.table_exists? ActiveRecord::Base.observers << :"interpret/expiration_observer" if !Interpret.sweeper && I18n::Backend::ActiveRecord::Translation.table_exists? end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
interpret-0.2.1 | lib/interpret/engine.rb |
interpret-0.2.0 | lib/interpret/engine.rb |
interpret-0.1.5 | lib/interpret/engine.rb |