Skip to content

Commit f2addb5

Browse files
committed
Fix "no anonymous block parameter" in ruby 3.1
Also change another anonymous block to a named block as requested by skipkayhil, although it does not trigger the same error as the method does not contain any keyword arguments.
1 parent 02f6c29 commit f2addb5

File tree

1 file changed

+4
-4
lines changed
  • activerecord/lib/active_record/connection_adapters/abstract

1 file changed

+4
-4
lines changed

activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ def query_cache_enabled
174174
end
175175

176176
# Enable the query cache within the block.
177-
def cache(&)
178-
pool.enable_query_cache(&)
177+
def cache(&block)
178+
pool.enable_query_cache(&block)
179179
end
180180

181181
def enable_query_cache!
@@ -186,8 +186,8 @@ def enable_query_cache!
186186
#
187187
# Set <tt>dirties: false</tt> to prevent query caches on all connections from being cleared by write operations.
188188
# (By default, write operations dirty all connections' query caches in case they are replicas whose cache would now be outdated.)
189-
def uncached(dirties: true, &)
190-
pool.disable_query_cache(dirties: dirties, &)
189+
def uncached(dirties: true, &block)
190+
pool.disable_query_cache(dirties: dirties, &block)
191191
end
192192

193193
def disable_query_cache!

0 commit comments

Comments
 (0)