activesupport 8.1.2.1 → 8.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c68d8c9bb247dcd9b6ba1a321f2f697ef70d56a5a2ab18f31995a5005a69004e
4
- data.tar.gz: 05f2bc953516e62fa3ec707bac717963bc567b1e7a2d2c9c2ad8ea82e05cb38b
3
+ metadata.gz: c80ab1d4d255b732c83bfb5b5d7da9e0ac3230629235966d792cb90af243133d
4
+ data.tar.gz: 30a9eb194ddb042db345b574c058ada1719c6da30a2d4b5705590daa3a7688ca
5
5
  SHA512:
6
- metadata.gz: bf2c57851277401b08d89b986357c78dd0676aa660a540dfde0411366377c7198a3350500da5a6e1145017e768d288d1ae85161330f282ec464a7733b286c414
7
- data.tar.gz: 14e9dc2f3c8d34c6cda4f319fd83555386ebb175b082a7f82d395f51c35d824055fec2fc4891a984d2e7e9e362be41304e3e285b16f3d0865950f7ddf58ce8cf
6
+ metadata.gz: fd6accf7d8d788a12ebae56dadeed982f6e2f58d1403ac8b609926aa03e3a72b5c6065729514cf989f5473e2ff274a64629dbdb9e6184c8cf177d1a255923a85
7
+ data.tar.gz: '083bae87b3dfa3488580a76f1fd336f4b4565fcbad97f0c2e9ef1a38642e27c02a50f53880692fa2695fae37e3efbf9a1a6a1b240fe5ea103a056756104064e0'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ ## Rails 8.1.3 (March 24, 2026) ##
2
+
3
+ * Fix `JSONGemCoderEncoder` to correctly serialize custom object hash keys.
4
+
5
+ When hash keys are custom objects whose `as_json` returns a Hash,
6
+ the encoder now calls `to_s` on the original key object instead of
7
+ on the `as_json` result.
8
+
9
+ Before:
10
+ hash = {CustomKey.new(123) => "value"}
11
+ hash.to_json # => {"{:id=>123}":"value"}
12
+
13
+ After:
14
+ hash.to_json # => {"custom_123":"value"}
15
+
16
+ *Dan Sharp*
17
+
18
+ * Fix inflections to better handle overlapping acronyms.
19
+
20
+ ```ruby
21
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
22
+ inflect.acronym "USD"
23
+ inflect.acronym "USDC"
24
+ end
25
+
26
+ "USDC".underscore # => "usdc"
27
+ ```
28
+
29
+ *Said Kaldybaev*
30
+
31
+ * Silence Dalli 4.0+ warning when using `ActiveSupport::Cache::MemCacheStore`.
32
+
33
+ *zzak*
34
+
35
+
1
36
  ## Rails 8.1.2.1 (March 23, 2026) ##
2
37
 
3
38
  * Reject scientific notation in NumberConverter
@@ -90,6 +90,9 @@ module ActiveSupport
90
90
  # The value "compress: false" prevents duplicate compression within Dalli.
91
91
  @mem_cache_options[:compress] = false
92
92
  (OVERRIDDEN_OPTIONS - %i(compress)).each { |name| @mem_cache_options.delete(name) }
93
+ # Set the default serializer for Dalli to prevent warning about
94
+ # inheriting the default serializer.
95
+ @mem_cache_options[:serializer] = Marshal
93
96
  @data = self.class.build_mem_cache(*(addresses + [@mem_cache_options]))
94
97
  end
95
98
 
@@ -1,6 +1 @@
1
1
  # frozen_string_literal: true
2
-
3
- # Remove this file from activesupport/lib/active_support/core_ext.rb when deleting the deprecation.
4
- ActiveSupport.deprecator.warn <<~TEXT
5
- active_support/core_ext/benchmark.rb is deprecated and will be removed in Rails 8.2 without replacement.
6
- TEXT
@@ -248,7 +248,7 @@ class String
248
248
  # optional parameter +capitalize+ to false.
249
249
  # By default, this parameter is true.
250
250
  #
251
- # The trailing '_id' can be kept and capitalized by setting the
251
+ # The trailing '_id' can be kept by setting the
252
252
  # optional parameter +keep_id_suffix+ to true.
253
253
  # By default, this parameter is false.
254
254
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- (Dir.glob(File.expand_path("core_ext/*.rb", __dir__)).sort - [File.expand_path("core_ext/benchmark.rb", __dir__)]).each do |path|
3
+ Dir.glob(File.expand_path("core_ext/*.rb", __dir__)).sort.each do |path|
4
4
  require path
5
5
  end
@@ -23,6 +23,13 @@ module ActiveSupport
23
23
  @store = @stack.pop
24
24
  self
25
25
  end
26
+
27
+ def flush
28
+ @stack = Array.new(@stack.size) { {} }
29
+ @store = {}
30
+ @current_attributes_instances = {}
31
+ self
32
+ end
26
33
  end
27
34
 
28
35
  @after_change_callbacks = []
@@ -97,6 +104,10 @@ module ActiveSupport
97
104
  IsolatedExecutionState[:active_support_execution_context] = nil
98
105
  end
99
106
 
107
+ def flush
108
+ record.flush
109
+ end
110
+
100
111
  def current_attributes_instances
101
112
  record.current_attributes_instances
102
113
  end
@@ -9,8 +9,8 @@ module ActiveSupport
9
9
  module VERSION
10
10
  MAJOR = 8
11
11
  MINOR = 1
12
- TINY = 2
13
- PRE = "1"
12
+ TINY = 3
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -265,7 +265,8 @@ module ActiveSupport
265
265
 
266
266
  private
267
267
  def define_acronym_regex_patterns
268
- @acronym_regex = @acronyms.empty? ? /(?=a)b/ : /#{@acronyms.values.join("|")}/
268
+ sorted_acronyms = @acronyms.empty? ? [] : @acronyms.values.sort_by { |a| -a.length }
269
+ @acronym_regex = sorted_acronyms.empty? ? /(?=a)b/ : /#{sorted_acronyms.join("|")}/
269
270
  @acronyms_camelize_regex = /^(?:#{@acronym_regex}(?=\b|[A-Z_])|\w)/
270
271
  @acronyms_underscore_regex = /(?:(?<=([A-Za-z\d]))|\b)(#{@acronym_regex})(?=\b|[^a-z])/
271
272
  end
@@ -119,7 +119,7 @@ module ActiveSupport
119
119
  # The capitalization of the first word can be turned off by setting the
120
120
  # +:capitalize+ option to false (default is true).
121
121
  #
122
- # The trailing '_id' can be kept and capitalized by setting the
122
+ # The trailing '_id' can be kept by setting the
123
123
  # optional parameter +keep_id_suffix+ to true (default is false).
124
124
  #
125
125
  # humanize('employee_salary') # => "Employee salary"
@@ -151,8 +151,10 @@ module ActiveSupport
151
151
  JSON_NATIVE_TYPES = [Hash, Array, Float, String, Symbol, Integer, NilClass, TrueClass, FalseClass, ::JSON::Fragment].freeze
152
152
  CODER = ::JSON::Coder.new do |value, is_key|
153
153
  json_value = value.as_json
154
+
154
155
  # Keep compatibility by calling to_s on non-String keys
155
- next json_value.to_s if is_key
156
+ next value.to_s if is_key && !(String === json_value)
157
+
156
158
  # Handle objects returning self from as_json
157
159
  if json_value.equal?(value)
158
160
  next ::JSON::Fragment.new(::JSON.generate(json_value))
@@ -49,7 +49,7 @@ module ActiveSupport
49
49
  initializer "active_support.reset_execution_context" do |app|
50
50
  app.reloader.before_class_unload do
51
51
  ActiveSupport::CurrentAttributes.clear_all
52
- ActiveSupport::ExecutionContext.clear
52
+ ActiveSupport::ExecutionContext.flush
53
53
  ActiveSupport.event_reporter.clear_context
54
54
  end
55
55
 
@@ -348,6 +348,9 @@ module ActiveSupport
348
348
  lines[0] = lines[0].byteslice(location[1]...)
349
349
  source = lines.join.strip
350
350
 
351
+ # Strip stabby lambda from Ruby 4.1+
352
+ source = source.sub(/^->\s*/, "")
353
+
351
354
  # We ignore procs defined with do/end as they are likely multi-line anyway.
352
355
  if source.start_with?("{")
353
356
  source.delete_suffix!("}")
@@ -44,7 +44,7 @@ module ActiveSupport
44
44
  ActiveSupport.error_reporter.subscribe(self)
45
45
  @subscribed = true
46
46
  else
47
- flunk("No error reporter is configured")
47
+ raise Minitest::Assertion, "No error reporter is configured"
48
48
  end
49
49
  end
50
50
  end
@@ -46,10 +46,12 @@ module ActiveSupport
46
46
 
47
47
  set_process_title("#{klass}##{method}")
48
48
 
49
- result = if Minitest.respond_to? :run_one_method then
50
- Minitest.run_one_method klass, method
51
- else
52
- klass.new(method).run
49
+ result = klass.with_info_handler reporter do
50
+ if Minitest.respond_to? :run_one_method
51
+ Minitest.run_one_method klass, method
52
+ else
53
+ klass.new(method).run
54
+ end
53
55
  end
54
56
 
55
57
  safe_record(reporter, result)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.2.1
4
+ version: 8.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -501,10 +501,10 @@ licenses:
501
501
  - MIT
502
502
  metadata:
503
503
  bug_tracker_uri: https://github.com/rails/rails/issues
504
- changelog_uri: https://github.com/rails/rails/blob/v8.1.2.1/activesupport/CHANGELOG.md
505
- documentation_uri: https://api.rubyonrails.org/v8.1.2.1/
504
+ changelog_uri: https://github.com/rails/rails/blob/v8.1.3/activesupport/CHANGELOG.md
505
+ documentation_uri: https://api.rubyonrails.org/v8.1.3/
506
506
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
507
- source_code_uri: https://github.com/rails/rails/tree/v8.1.2.1/activesupport
507
+ source_code_uri: https://github.com/rails/rails/tree/v8.1.3/activesupport
508
508
  rubygems_mfa_required: 'true'
509
509
  rdoc_options:
510
510
  - "--encoding"