Skip to content

Commit 5bb357f

Browse files
committed
Use adapter_class instead of connection_class for adapters
In Active Record `connection_class` already means "the class in your application that established the connection" so I would prefer it only have that one meaning. This change swaps `connection_class` for `adapter_class` where applicable.
1 parent a4eeb2b commit 5bb357f

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
module ActiveRecord
1010
module ConnectionHandling # :nodoc:
11-
def mysql2_connection_class
11+
def mysql2_adapter_class
1212
ConnectionAdapters::Mysql2Adapter
1313
end
1414

1515
# Establishes a connection to the database that's used by all Active Record objects.
1616
def mysql2_connection(config)
17-
mysql2_connection_class.new(config)
17+
mysql2_adapter_class.new(config)
1818
end
1919
end
2020

activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222
module ActiveRecord
2323
module ConnectionHandling # :nodoc:
24-
def postgresql_connection_class
24+
def postgresql_adapter_class
2525
ConnectionAdapters::PostgreSQLAdapter
2626
end
2727

2828
# Establishes a connection to the database that's used by all Active Record objects
2929
def postgresql_connection(config)
30-
postgresql_connection_class.new(config)
30+
postgresql_adapter_class.new(config)
3131
end
3232
end
3333

activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
module ActiveRecord
1717
module ConnectionHandling # :nodoc:
18-
def sqlite3_connection_class
18+
def sqlite3_adapter_class
1919
ConnectionAdapters::SQLite3Adapter
2020
end
2121

2222
def sqlite3_connection(config)
23-
sqlite3_connection_class.new(config)
23+
sqlite3_adapter_class.new(config)
2424
end
2525
end
2626

activerecord/lib/active_record/database_configurations/database_config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def adapter_method
1818
end
1919

2020
def adapter_class_method
21-
"#{adapter}_connection_class"
21+
"#{adapter}_adapter_class"
2222
end
2323

2424
def host

railties/lib/rails/commands/dbconsole/dbconsole_command.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize(options = {})
1616
end
1717

1818
def start
19-
connection_class.dbconsole(db_config, @options)
19+
adapter_class.dbconsole(db_config, @options)
2020
rescue NotImplementedError
2121
abort "Unknown command-line client for #{db_config.database}."
2222
end
@@ -50,7 +50,7 @@ def environment
5050
end
5151

5252
private
53-
def connection_class
53+
def adapter_class
5454
if ActiveRecord::Base.respond_to?(db_config.adapter_class_method)
5555
ActiveRecord::Base.public_send(db_config.adapter_class_method)
5656
else

0 commit comments

Comments
 (0)