Sha256: 4f96fc611b9d829f83e42d601dad6b7208b7ad97f9c614cd5d3781a51c0990e1
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require 'interpret/logger' module Interpret class Engine < Rails::Engine isolate_namespace Interpret engine_name "interpret" 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| require 'active_record' require 'i18n/backend/active_record' 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
interpret-1.1.0 | lib/interpret/engine.rb |