Class: Dotenv::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/dotenv/rails.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.loadObject

Rails uses ‘#method_missing` to delegate all class methods to the instance, which means `Kernel#load` gets called here. We don’t want that.



23
24
25
# File 'lib/dotenv/rails.rb', line 23

def self.load
  instance.load
end

Instance Method Details

#loadObject

Public: Load dotenv

This will get called during the ‘before_configuration` callback, but you can manually call `Dotenv::Railtie.load` if you needed it sooner.



16
17
18
19
# File 'lib/dotenv/rails.rb', line 16

def load
  Dotenv.load Rails.root.join('.env')
  Spring.watch Rails.root.join('.env') if defined?(Spring)
end