Skip to content
Alexander Popov edited this page Feb 9, 2021 · 1 revision

Application config available by config method, class or instance, from application and controller. Config object is like a Hash, but with enhancements.

Root directory of application available by config[:root_dir].

There are also :public_dir, :views_dir, :config_dir and others available.

Config options may be proc and will be called automatically on access:

config[:locales_dir] = proc { File.join(config[:root_dir], 'locales' }
# config[:locales_dir] => '%app_root_dir%/locales'

Environment is also available by config[:environment]: typically it's equal to ENV['RACK_ENV'] or development.

Clone this wiki locally