File tree Expand file tree Collapse file tree 6 files changed +23
-19
lines changed
lib/rails/generators/rails/app/templates/config/initializers Expand file tree Collapse file tree 6 files changed +23
-19
lines changed Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
require "active_support/core_ext/digest/uuid"
4
-
5
- module ActiveSupport
6
- class << self
7
- delegate :use_rfc4122_namespaced_uuids , :use_rfc4122_namespaced_uuids= , to : :'Digest::UUID'
8
- end
9
- end
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ class Railtie < Rails::Railtie # :nodoc:
133
133
config . after_initialize do
134
134
if app . config . active_support . use_rfc4122_namespaced_uuids
135
135
require "active_support/core_ext/digest"
136
- ActiveSupport . use_rfc4122_namespaced_uuids = app . config . active_support . use_rfc4122_namespaced_uuids
136
+ :: Digest :: UUID . use_rfc4122_namespaced_uuids = app . config . active_support . use_rfc4122_namespaced_uuids
137
137
end
138
138
end
139
139
end
Original file line number Diff line number Diff line change 4
4
require "active_support/core_ext/digest"
5
5
6
6
class DigestUUIDExt < ActiveSupport ::TestCase
7
- def with_use_rfc4122_namespaced_uuids_set
8
- old_value = ActiveSupport . use_rfc4122_namespaced_uuids
9
- ActiveSupport . use_rfc4122_namespaced_uuids = true
10
- yield
11
- ensure
12
- ActiveSupport . use_rfc4122_namespaced_uuids = old_value
13
- end
14
-
15
7
def test_constants
16
8
assert_equal "6ba7b810-9dad-11d1-80b4-00c04fd430c8" , "%08x-%04x-%04x-%04x-%04x%08x" % Digest ::UUID ::DNS_NAMESPACE . unpack ( "NnnnnN" )
17
9
assert_equal "6ba7b811-9dad-11d1-80b4-00c04fd430c8" , "%08x-%04x-%04x-%04x-%04x%08x" % Digest ::UUID ::URL_NAMESPACE . unpack ( "NnnnnN" )
@@ -184,4 +176,13 @@ def test_invalid_hash_class
184
176
Digest ::UUID . uuid_from_hash ( OpenSSL ::Digest ::SHA256 , Digest ::UUID ::OID_NAMESPACE , "1.2.3" )
185
177
end
186
178
end
179
+
180
+ private
181
+ def with_use_rfc4122_namespaced_uuids_set
182
+ old_value = Digest ::UUID . use_rfc4122_namespaced_uuids
183
+ Digest ::UUID . use_rfc4122_namespaced_uuids = true
184
+ yield
185
+ ensure
186
+ Digest ::UUID . use_rfc4122_namespaced_uuids = old_value
187
+ end
187
188
end
Original file line number Diff line number Diff line change @@ -1729,6 +1729,7 @@ Accepts a string for the HTML tag used to wrap attachments. Defaults to `"action
1729
1729
- ` config.active_support.cache_format_version` : ` 7.0`
1730
1730
- ` config.active_support.remove_deprecated_time_with_zone_name` : ` true`
1731
1731
- ` config.active_support.executor_around_test_case` : ` true`
1732
+ - ` config.active_support.use_rfc4122_namespaced_uuids` : ` true`
1732
1733
- ` config.action_dispatch.return_only_request_media_type_on_content_type` : ` false`
1733
1734
- ` config.action_controller.silence_disabled_session_errors` : ` false`
1734
1735
- ` config.action_mailer.smtp_timeout` : ` 5`
@@ -1816,6 +1817,7 @@ Accepts a string for the HTML tag used to wrap attachments. Defaults to `"action
1816
1817
- ` config.active_support.key_generator_hash_digest_class` : ` OpenSSL::Digest::SHA1`
1817
1818
- ` config.active_support.cache_format_version` : ` 6.1`
1818
1819
- ` config.active_support.executor_around_test_case` : ` false`
1820
+ - ` ` config.active_support.use_rfc4122_namespaced_uuids` ` : ` false`
1819
1821
- ` config.action_dispatch.return_only_request_media_type_on_content_type` : ` true`
1820
1822
- ` ActiveSupport.utc_to_local_returns_utc_offset_times` : ` false`
1821
1823
- ` config.action_mailer.smtp_timeout` : ` nil`
Original file line number Diff line number Diff line change 97
97
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
98
98
# To disable parameter wrapping entirely, set this config to `false`.
99
99
# Rails.application.config.action_controller.wrap_parameters_by_default = true
100
+
101
+ # Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
102
+ # `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
103
+ #
104
+ # See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
105
+ # more information
106
+ # Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
Original file line number Diff line number Diff line change @@ -2422,18 +2422,18 @@ def index
2422
2422
assert_equal 1234 , ActiveSupport . test_parallelization_threshold
2423
2423
end
2424
2424
2425
- test "ActiveSupport .use_rfc4122_namespaced_uuids is enabled by default for new apps" do
2425
+ test "Digest::UUID .use_rfc4122_namespaced_uuids is enabled by default for new apps" do
2426
2426
app "development"
2427
2427
2428
- assert_equal true , ActiveSupport . use_rfc4122_namespaced_uuids
2428
+ assert_equal true , Digest :: UUID . use_rfc4122_namespaced_uuids
2429
2429
end
2430
2430
2431
- test "ActiveSupport .use_rfc4122_namespaced_uuids is disabled by default for upgraded apps" do
2431
+ test "Digest::UUID .use_rfc4122_namespaced_uuids is disabled by default for upgraded apps" do
2432
2432
remove_from_config '.*config\.load_defaults.*\n'
2433
2433
2434
2434
app "development"
2435
2435
2436
- assert_equal false , ActiveSupport . use_rfc4122_namespaced_uuids
2436
+ assert_equal false , Digest :: UUID . use_rfc4122_namespaced_uuids
2437
2437
end
2438
2438
2439
2439
test "custom serializers should be able to set via config.active_job.custom_serializers in an initializer" do
You can’t perform that action at this time.
0 commit comments