Skip to content

Commit 4e6228f

Browse files
voxikrafaelfranca
authored andcommitted
Fix cache_format for Rails 8
Rails 8 have not introduced new cache format such as `8.0`. Keep using the highest available ATM.
1 parent 36c0347 commit 4e6228f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/cases/railtie_test.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ def setup
1616
@app.config.eager_load = false
1717
@app.config.logger = Logger.new(nil)
1818
@app.config.secret_key_base = ('x' * 30)
19-
@app.config.active_support.cache_format_version = Rails::VERSION::STRING.to_f
19+
# Rails supports `cache_format` up to `7.1`.
20+
# https://github.com/rails/rails/blob/aa66aece44f191e6330c04ce4942c3edf31d85d7/activesupport/lib/active_support/cache.rb#L800-L809
21+
@app.config.active_support.cache_format_version = if Rails::VERSION::STRING.to_f < 8
22+
Rails::VERSION::STRING.to_f
23+
else
24+
7.1
25+
end
2026
end
2127

2228
test 'GlobalID.app for Blog::Application defaults to blog' do

0 commit comments

Comments
 (0)