Class: Ooor::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/ooor/railtie.rb

Instance Method Summary collapse

Instance Method Details

#load_config(config_file = nil, env = nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/ooor/railtie.rb', line 31

def load_config(config_file=nil, env=nil)
  config_file ||= defined?(Rails.root) && "#{Rails.root}/config/ooor.yml" || 'ooor.yml'
  @config = HashWithIndifferentAccess.new(::YAML.load_file(config_file)[env || 'development'])
rescue SystemCallError
  Ooor.logger.error """failed to load OOOR yaml configuration file.
     make sure your app has a #{config_file} file correctly set up
     if not, just copy/paste the default ooor.yml file from the OOOR Gem
     to #{Rails.root}/config/ooor.yml and customize it properly\n\n"""
  {}
end