Skip to content

Commit 7861476

Browse files
committed
Encourage #lease_connection over #connection on AR model #inspect without connection
1 parent 284baa1 commit 7861476

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

activerecord/lib/active_record/core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def inspect # :nodoc:
354354
elsif abstract_class?
355355
"#{super}(abstract)"
356356
elsif !connected?
357-
"#{super} (call '#{super}.connection' to establish a connection)"
357+
"#{super} (call '#{super}.lease_connection' to establish a connection)"
358358
elsif table_exists?
359359
attr_list = attribute_types.map { |name, type| "#{name}: #{type.type}" } * ", "
360360
"#{super}(#{attr_list})"

activerecord/test/cases/invalid_connection_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setup
2020
end
2121

2222
test "inspect on Model class does not raise" do
23-
assert_equal "#{Bird.name} (call '#{Bird.name}.connection' to establish a connection)", Bird.inspect
23+
assert_equal "#{Bird.name} (call '#{Bird.name}.lease_connection' to establish a connection)", Bird.inspect
2424
end
2525
end
2626
end

0 commit comments

Comments
 (0)