Module: ActiveSupport::Dependencies::Extend

Included in:
ActiveSupport::Dependencies
Defined in:
lib/translation_rails/dependencies.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
# File 'lib/translation_rails/dependencies.rb', line 6

def self.included(base)
  base.class_eval do
    alias_method_chain :require_or_load, :translation_rails
  end
end

Instance Method Details

#require_or_load_with_translation_rails(file_name, const_path = nil) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/translation_rails/dependencies.rb', line 12

def require_or_load_with_translation_rails(file_name, const_path = nil)
  require_or_load_without_translation_rails(file_name, const_path)
  if file_name.starts_with?(Rails.root.to_s + '/app')
    relative_name = file_name.gsub(Rails.root.to_s, '')
    engine_file = File.join(TranslationRails::Engine.root, relative_name)
    require_or_load_without_translation_rails(engine_file, const_path) if File.file?(engine_file)
  end
end