• Rémy Coutable's avatar
    Ensure rake tasks that don't need a DB connection can be run without one · e6f3fe5d
    Rémy Coutable authored
    When using ActiveRecord::Base.connection.active? without a DB
    connection, we get a "PG::ConnectionBad: could not connect to server"
    error because ActiveRecord::Base.connection doesn't exist. By using
    ActiveRecord::Base.connected? we ensure we don't get this error if
    the connection is missing, which is the all point of the
    Gitlab::CurrentSettings#connect_to_db? method!
    e6f3fe5d
current_settings.rb 2.04 KB