• Rémy Coutable's avatar
    Ensure rake tasks that don't need a DB connection can be run without one · b34a4116
    Rémy Coutable authored
    ( cherry picked from commit e6f3fe5d upstream )
    
    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!
    b34a4116
current_settings.rb 1.62 KB