Merge pull request #17305 from ziggythehamster/activerecord-connectionhandling-RAILS_ENV-without-rails

If Rails is not defined, check ENV["RAILS_ENV"] and ENV["RACK_ENV"] in ActiveRecord::ConnectionHandling
Conflicts:
	activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb