class Rails::Application::Configuration

Parent:
Rails::Engine::Configuration

Attributes

allow_concurrency[RW]
asset_host[RW]
assets[RW]
autoflush_log[RW]
beginning_of_week[RW]
cache_classes[RW]
cache_store[RW]
consider_all_requests_local[RW]
console[RW]
eager_load[RW]
encoding[R]
exceptions_app[RW]
file_watcher[RW]
filter_parameters[RW]
filter_redirect[RW]
force_ssl[RW]
helpers_paths[RW]
log_formatter[RW]
log_tags[RW]
logger[RW]
railties_order[RW]
relative_url_root[RW]
reload_classes_only_on_change[RW]
secret_key_base[RW]
secret_token[RW]
serve_static_files[RW]
session_options[RW]
ssl_options[RW]
static_cache_control[RW]
time_zone[RW]
x[RW]

Public Class Methods

new(*) Show source
# File railties/lib/rails/application/configuration.rb, line 22
def initialize(*)
  super
  self.encoding = "utf-8"
  @allow_concurrency             = nil
  @consider_all_requests_local   = false
  @filter_parameters             = []
  @filter_redirect               = []
  @helpers_paths                 = []
  @serve_static_files            = true
  @static_cache_control          = nil
  @force_ssl                     = false
  @ssl_options                   = {}
  @session_store                 = :cookie_store
  @session_options               = {}
  @time_zone                     = "UTC"
  @beginning_of_week             = :monday
  @has_explicit_log_level        = false
  @log_level                     = nil
  @middleware                    = app_middleware
  @generators                    = app_generators
  @cache_store                   = [ :file_store, "#{root}/tmp/cache/" ]
  @railties_order                = [:all]
  @relative_url_root             = ENV["RAILS_RELATIVE_URL_ROOT"]
  @reload_classes_only_on_change = true
  @file_watcher                  = ActiveSupport::FileUpdateChecker
  @exceptions_app                = nil
  @autoflush_log                 = true
  @log_formatter                 = ActiveSupport::Logger::SimpleFormatter.new
  @eager_load                    = nil
  @secret_token                  = nil
  @secret_key_base               = nil
  @x                             = Custom.new

  @assets = ActiveSupport::OrderedOptions.new
  @assets.enabled                  = true
  @assets.paths                    = []
  @assets.precompile               = [ Proc.new { |path, fn| fn =~ /app\/assets/ && !%w(.js .css).include?(File.extname(path)) },
                                       /(?:\/|\|\A)application\.(css|js)$/ ]
  @assets.prefix                   = "/assets"
  @assets.version                  = '1.0'
  @assets.debug                    = false
  @assets.compile                  = true
  @assets.digest                   = false
  @assets.cache_store              = [ :file_store, "#{root}/tmp/cache/assets/#{Rails.env}/" ]
  @assets.js_compressor            = nil
  @assets.css_compressor           = nil
  @assets.logger                   = nil
end
Calls superclass method Rails::Engine::Configuration.new

Public Instance Methods

colorize_logging() Show source
# File railties/lib/rails/application/configuration.rb, line 135
def colorize_logging
  ActiveSupport::LogSubscriber.colorize_logging
end
colorize_logging=(val) Show source
# File railties/lib/rails/application/configuration.rb, line 139
def colorize_logging=(val)
  ActiveSupport::LogSubscriber.colorize_logging = val
  self.generators.colorize_logging = val
end
database_configuration() Show source
# File railties/lib/rails/application/configuration.rb, line 97
def database_configuration
  path = paths["config/database"].existent.first
  yaml = Pathname.new(path) if path

  config = if yaml && yaml.exist?
    require "yaml"
    require "erb"
    YAML.load(ERB.new(yaml.read).result) || {}
  elsif ENV['DATABASE_URL']
    # Value from ENV['DATABASE_URL'] is set to default database connection
    # by Active Record.
    {}
  else
    raise "Could not load database configuration. No such file - #{paths["config/database"].instance_variable_get(:@paths)}"
  end

  config
rescue Psych::SyntaxError => e
  raise "YAML syntax error occurred while parsing #{paths["config/database"].first}. "                "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. "                "Error: #{e.message}"
rescue => e
  raise e, "Cannot load `Rails.application.database_configuration`:\n#{e.message}", e.backtrace
end

Loads and returns the entire raw configuration of database from values stored in `config/database.yml`.

encoding=(value) Show source
# File railties/lib/rails/application/configuration.rb, line 71
def encoding=(value)
  @encoding = value
  silence_warnings do
    Encoding.default_external = value
    Encoding.default_internal = value
  end
end
log_level() Show source
# File railties/lib/rails/application/configuration.rb, line 131
def log_level
  @log_level ||= (Rails.env.production? ? :info : :debug)
end
log_level=(level) Show source
# File railties/lib/rails/application/configuration.rb, line 126
def log_level=(level)
  @has_explicit_log_level = !!(level)
  @log_level = level
end
paths() Show source
# File railties/lib/rails/application/configuration.rb, line 79
def paths
  @paths ||= begin
    paths = super
    paths.add "config/database",    with: "config/database.yml"
    paths.add "config/secrets",     with: "config/secrets.yml"
    paths.add "config/environment", with: "config/environment.rb"
    paths.add "lib/templates"
    paths.add "log",                with: "log/#{Rails.env}.log"
    paths.add "public"
    paths.add "public/javascripts"
    paths.add "public/stylesheets"
    paths.add "tmp"
    paths
  end
end
Calls superclass method Rails::Engine::Configuration#paths

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.