activesupport 5.2.4.1 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +372 -397
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +3 -2
  5. data/lib/active_support.rb +2 -1
  6. data/lib/active_support/actionable_error.rb +48 -0
  7. data/lib/active_support/backtrace_cleaner.rb +28 -1
  8. data/lib/active_support/cache.rb +45 -23
  9. data/lib/active_support/cache/file_store.rb +22 -22
  10. data/lib/active_support/cache/mem_cache_store.rb +5 -0
  11. data/lib/active_support/cache/memory_store.rb +9 -2
  12. data/lib/active_support/cache/null_store.rb +5 -0
  13. data/lib/active_support/cache/redis_cache_store.rb +37 -10
  14. data/lib/active_support/callbacks.rb +16 -5
  15. data/lib/active_support/concern.rb +24 -1
  16. data/lib/active_support/configurable.rb +7 -11
  17. data/lib/active_support/core_ext/array.rb +1 -1
  18. data/lib/active_support/core_ext/array/access.rb +18 -6
  19. data/lib/active_support/core_ext/array/extract.rb +21 -0
  20. data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -6
  21. data/lib/active_support/core_ext/class/attribute.rb +11 -16
  22. data/lib/active_support/core_ext/class/subclasses.rb +1 -1
  23. data/lib/active_support/core_ext/date/calculations.rb +6 -5
  24. data/lib/active_support/core_ext/date_and_time/calculations.rb +24 -47
  25. data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
  26. data/lib/active_support/core_ext/enumerable.rb +97 -73
  27. data/lib/active_support/core_ext/hash.rb +1 -2
  28. data/lib/active_support/core_ext/hash/compact.rb +2 -26
  29. data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
  30. data/lib/active_support/core_ext/hash/except.rb +1 -1
  31. data/lib/active_support/core_ext/hash/keys.rb +0 -29
  32. data/lib/active_support/core_ext/hash/slice.rb +3 -25
  33. data/lib/active_support/core_ext/hash/transform_values.rb +2 -29
  34. data/lib/active_support/core_ext/integer/multiple.rb +1 -1
  35. data/lib/active_support/core_ext/kernel.rb +0 -1
  36. data/lib/active_support/core_ext/load_error.rb +1 -1
  37. data/lib/active_support/core_ext/module.rb +0 -1
  38. data/lib/active_support/core_ext/module/attribute_accessors.rb +7 -10
  39. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +13 -19
  40. data/lib/active_support/core_ext/module/delegation.rb +33 -7
  41. data/lib/active_support/core_ext/module/introspection.rb +37 -13
  42. data/lib/active_support/core_ext/module/reachable.rb +1 -6
  43. data/lib/active_support/core_ext/module/redefine_method.rb +8 -17
  44. data/lib/active_support/core_ext/numeric.rb +0 -1
  45. data/lib/active_support/core_ext/numeric/conversions.rb +124 -128
  46. data/lib/active_support/core_ext/numeric/inquiry.rb +2 -25
  47. data/lib/active_support/core_ext/object/blank.rb +1 -2
  48. data/lib/active_support/core_ext/object/duplicable.rb +7 -114
  49. data/lib/active_support/core_ext/object/json.rb +1 -0
  50. data/lib/active_support/core_ext/object/try.rb +15 -7
  51. data/lib/active_support/core_ext/object/with_options.rb +1 -1
  52. data/lib/active_support/core_ext/range/compare_range.rb +28 -13
  53. data/lib/active_support/core_ext/range/conversions.rb +31 -29
  54. data/lib/active_support/core_ext/range/include_range.rb +6 -0
  55. data/lib/active_support/core_ext/range/include_time_with_zone.rb +2 -2
  56. data/lib/active_support/core_ext/regexp.rb +0 -4
  57. data/lib/active_support/core_ext/securerandom.rb +23 -3
  58. data/lib/active_support/core_ext/string/access.rb +8 -0
  59. data/lib/active_support/core_ext/string/filters.rb +42 -1
  60. data/lib/active_support/core_ext/string/inflections.rb +7 -2
  61. data/lib/active_support/core_ext/string/multibyte.rb +4 -3
  62. data/lib/active_support/core_ext/string/output_safety.rb +63 -5
  63. data/lib/active_support/core_ext/string/strip.rb +3 -1
  64. data/lib/active_support/core_ext/time/calculations.rb +31 -2
  65. data/lib/active_support/core_ext/uri.rb +1 -0
  66. data/lib/active_support/current_attributes.rb +8 -0
  67. data/lib/active_support/dependencies.rb +69 -16
  68. data/lib/active_support/dependencies/zeitwerk_integration.rb +118 -0
  69. data/lib/active_support/deprecation.rb +1 -1
  70. data/lib/active_support/deprecation/behaviors.rb +1 -1
  71. data/lib/active_support/deprecation/method_wrappers.rb +8 -20
  72. data/lib/active_support/deprecation/proxy_wrappers.rb +24 -5
  73. data/lib/active_support/descendants_tracker.rb +56 -9
  74. data/lib/active_support/duration.rb +6 -5
  75. data/lib/active_support/duration/iso8601_parser.rb +2 -3
  76. data/lib/active_support/duration/iso8601_serializer.rb +3 -4
  77. data/lib/active_support/encrypted_configuration.rb +0 -4
  78. data/lib/active_support/encrypted_file.rb +2 -1
  79. data/lib/active_support/evented_file_update_checker.rb +39 -9
  80. data/lib/active_support/execution_wrapper.rb +1 -0
  81. data/lib/active_support/gem_version.rb +4 -4
  82. data/lib/active_support/hash_with_indifferent_access.rb +22 -18
  83. data/lib/active_support/i18n.rb +1 -0
  84. data/lib/active_support/i18n_railtie.rb +9 -1
  85. data/lib/active_support/inflector/inflections.rb +1 -4
  86. data/lib/active_support/inflector/methods.rb +15 -27
  87. data/lib/active_support/inflector/transliterate.rb +47 -18
  88. data/lib/active_support/json/decoding.rb +23 -23
  89. data/lib/active_support/json/encoding.rb +6 -2
  90. data/lib/active_support/key_generator.rb +0 -32
  91. data/lib/active_support/lazy_load_hooks.rb +5 -1
  92. data/lib/active_support/locale/en.rb +31 -0
  93. data/lib/active_support/log_subscriber.rb +31 -8
  94. data/lib/active_support/logger.rb +0 -15
  95. data/lib/active_support/logger_silence.rb +28 -12
  96. data/lib/active_support/logger_thread_safe_level.rb +26 -4
  97. data/lib/active_support/message_encryptor.rb +3 -5
  98. data/lib/active_support/message_verifier.rb +3 -3
  99. data/lib/active_support/multibyte/chars.rb +29 -48
  100. data/lib/active_support/multibyte/unicode.rb +44 -281
  101. data/lib/active_support/notifications.rb +41 -4
  102. data/lib/active_support/notifications/fanout.rb +98 -13
  103. data/lib/active_support/notifications/instrumenter.rb +80 -8
  104. data/lib/active_support/number_helper.rb +7 -0
  105. data/lib/active_support/number_helper/number_to_currency_converter.rb +2 -2
  106. data/lib/active_support/number_helper/number_to_delimited_converter.rb +3 -1
  107. data/lib/active_support/number_helper/number_to_human_converter.rb +3 -1
  108. data/lib/active_support/number_helper/number_to_human_size_converter.rb +3 -1
  109. data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
  110. data/lib/active_support/number_helper/number_to_phone_converter.rb +2 -0
  111. data/lib/active_support/number_helper/number_to_rounded_converter.rb +5 -3
  112. data/lib/active_support/ordered_hash.rb +1 -1
  113. data/lib/active_support/ordered_options.rb +1 -1
  114. data/lib/active_support/parameter_filter.rb +129 -0
  115. data/lib/active_support/rails.rb +0 -6
  116. data/lib/active_support/reloader.rb +4 -5
  117. data/lib/active_support/security_utils.rb +1 -1
  118. data/lib/active_support/subscriber.rb +65 -26
  119. data/lib/active_support/tagged_logging.rb +13 -4
  120. data/lib/active_support/test_case.rb +91 -0
  121. data/lib/active_support/testing/assertions.rb +15 -1
  122. data/lib/active_support/testing/deprecation.rb +0 -1
  123. data/lib/active_support/testing/file_fixtures.rb +2 -0
  124. data/lib/active_support/testing/isolation.rb +2 -2
  125. data/lib/active_support/testing/method_call_assertions.rb +28 -1
  126. data/lib/active_support/testing/parallelization.rb +128 -0
  127. data/lib/active_support/testing/stream.rb +1 -1
  128. data/lib/active_support/testing/time_helpers.rb +7 -7
  129. data/lib/active_support/time_with_zone.rb +15 -5
  130. data/lib/active_support/values/time_zone.rb +12 -7
  131. data/lib/active_support/xml_mini.rb +2 -9
  132. data/lib/active_support/xml_mini/jdom.rb +2 -2
  133. data/lib/active_support/xml_mini/libxml.rb +2 -2
  134. data/lib/active_support/xml_mini/libxmlsax.rb +4 -4
  135. data/lib/active_support/xml_mini/nokogiri.rb +2 -2
  136. data/lib/active_support/xml_mini/nokogirisax.rb +3 -3
  137. data/lib/active_support/xml_mini/rexml.rb +2 -2
  138. metadata +30 -8
  139. data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
  140. data/lib/active_support/values/unicode_tables.dat +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63ec42059f6cf3bef91cddb9342a4c0aa51761a2553f932919e283a6a1e70a19
4
- data.tar.gz: 34241f0f3751d1381cb22f792290528cc809530f3aade8937d0e6a60b14654f1
3
+ metadata.gz: 89999be252d7cdb9b27994ea4a149baabf876606a5899e8c7dfe5309278bf57a
4
+ data.tar.gz: c79f2634e9a995e6c0ad95ca68f3a04905153502560e2a25de871cb4c4782e4f
5
5
  SHA512:
6
- metadata.gz: fc8171b6755b13497efdb76430c925b66bdd16ea4440ac2a3625e03655aa63394aad91a4bddcfee030bfd6d2a130bfc31654b6c08fcf0ba4f8b541a29627a74c
7
- data.tar.gz: c0021f8f84d535d8aad50c3561a959c3ba4485a4a6bcd0dfeeb92fb316369b6db49e10c8c7ef4f616efe75d17748194bd1ccb96e8870aefc2f4f167b82048110
6
+ metadata.gz: 9aed32dcff5ff2bbeaeb386f289292c3a18d8bf3dde6d5a72eff792f41216041853fbbbefe01aa35aef16330f13a54bca4744235bdee5a90783e34bc8b48c1f6
7
+ data.tar.gz: 6ceefce5d0753a5a91df29b365579b8e84be9b252b5abe5c7e3f5183dad8a9389a0de2fc50f6668147d6b9def2efe9e6dc1dc48e221dda19767586a37a9d3d3f
@@ -1,9 +1,58 @@
1
- ## Rails 5.2.4.1 (December 18, 2019) ##
1
+ ## Rails 6.0.1 (November 5, 2019) ##
2
2
 
3
- * No changes.
3
+ * `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
4
+
5
+ *Shugo Maeda*
6
+
7
+ * The Redis cache store fails gracefully when the server returns a "max number
8
+ of clients reached" error.
9
+
10
+ *Brandon Medenwald*
11
+
12
+ * Fixed that mutating a value returned by a memory cache store would
13
+ unexpectedly change the cached value.
14
+
15
+ *Jonathan Hyman*
16
+
17
+ * The default inflectors in `zeitwerk` mode support overrides:
18
+
19
+ ```ruby
20
+ # config/initializers/zeitwerk.rb
21
+ Rails.autoloaders.each do |autoloader|
22
+ autoloader.inflector.inflect(
23
+ "html_parser" => "HTMLParser",
24
+ "ssl_error" => "SSLError"
25
+ )
26
+ end
27
+ ```
28
+
29
+ That way, you can tweak how individual basenames are inflected without touching Active Support inflection rules, which are global. These inflectors fallback to `String#camelize`, so existing inflection rules are still taken into account for non-overridden basenames.
30
+
31
+ Please, check the [autoloading guide for `zeitwerk` mode](https://guides.rubyonrails.org/v6.0/autoloading_and_reloading_constants.html#customizing-inflections) if you prefer not to depend on `String#camelize` at all.
4
32
 
33
+ *Xavier Noria*
5
34
 
6
- ## Rails 5.2.4 (November 27, 2019) ##
35
+ * Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
36
+ and endless range targets.
37
+
38
+ *Allen Hsu*, *Andrew Hodgkinson*
39
+
40
+ * Don't use `Process#clock_gettime(CLOCK_PROCESS_CPUTIME_ID)` on Solaris
41
+
42
+ *Iain Beeston*
43
+
44
+
45
+ ## Rails 6.0.0 (August 16, 2019) ##
46
+
47
+ * Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
48
+ better backwards compatibility.
49
+
50
+ *Xavier Noria*
51
+
52
+ * Let `require_dependency` in `zeitwerk` mode support arguments that respond
53
+ to `to_path` for better backwards compatibility.
54
+
55
+ *Xavier Noria*
7
56
 
8
57
  * Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
9
58
 
@@ -37,606 +86,532 @@
37
86
 
38
87
  *Alexander Varnin*
39
88
 
89
+ * Do not delegate missing `marshal_dump` and `_dump` methods via the
90
+ `delegate_missing_to` extension. This avoids unintentionally adding instance
91
+ variables when calling `Marshal.dump(object)`, should the delegation target of
92
+ `object` be a method which would otherwise add them. Fixes #36522.
40
93
 
41
- ## Rails 5.2.3 (March 27, 2019) ##
42
-
43
- * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
44
-
45
- `assoc` can now be called with either a string or a symbol.
94
+ *Aaron Lipman*
46
95
 
47
- *Stefan Schüßler*
48
96
 
49
- * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
97
+ ## Rails 6.0.0.rc2 (July 22, 2019) ##
50
98
 
51
- *Keenan Brock*
99
+ * `truncate` would return the original string if it was too short to be truncated
100
+ and a frozen string if it were long enough to be truncated. Now truncate will
101
+ consistently return an unfrozen string regardless. This behavior is consistent
102
+ with `gsub` and `strip`.
52
103
 
53
- * Allow Range#=== and Range#cover? on Range
104
+ Before:
54
105
 
55
- `Range#cover?` can now accept a range argument like `Range#include?` and
56
- `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
57
- into a new file, with these two methods.
106
+ 'foobar'.truncate(5).frozen?
107
+ # => true
108
+ 'foobar'.truncate(6).frozen?
109
+ # => false
58
110
 
59
- *utilum*
111
+ After:
60
112
 
61
- * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
113
+ 'foobar'.truncate(5).frozen?
114
+ # => false
115
+ 'foobar'.truncate(6).frozen?
116
+ # => false
62
117
 
63
- *Mark J. Titorenko*, *Vlad Bokov*
118
+ *Jordan Thomas*
64
119
 
65
120
 
66
- ## Rails 5.2.2.1 (March 11, 2019) ##
67
-
68
- * No changes.
121
+ ## Rails 6.0.0.rc1 (April 24, 2019) ##
69
122
 
123
+ * Introduce `ActiveSupport::ActionableError`.
70
124
 
71
- ## Rails 5.2.2 (December 04, 2018) ##
125
+ Actionable errors let's you dispatch actions from Rails' error pages. This
126
+ can help you save time if you have a clear action for the resolution of
127
+ common development errors.
72
128
 
73
- * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
74
- would not act as alias for `#symbolize_keys`.
129
+ The de-facto example are pending migrations. Every time pending migrations
130
+ are found, a middleware raises an error. With actionable errors, you can
131
+ run the migrations right from the error page. Other examples include Rails
132
+ plugins that need to run a rake task to setup themselves. They can now
133
+ raise actionable errors to run the setup straight from the error pages.
75
134
 
76
- *Nick Weiland*
135
+ Here is how to define an actionable error:
77
136
 
78
- * Improve the logic that detects non-autoloaded constants.
137
+ ```ruby
138
+ class PendingMigrationError < MigrationError #:nodoc:
139
+ include ActiveSupport::ActionableError
79
140
 
80
- *Jan Habermann*, *Xavier Noria*
141
+ action "Run pending migrations" do
142
+ ActiveRecord::Tasks::DatabaseTasks.migrate
143
+ end
144
+ end
145
+ ```
81
146
 
82
- * Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
147
+ To make an error actionable, include the `ActiveSupport::ActionableError`
148
+ module and invoke the `action` class macro to define the action. An action
149
+ needs a name and a procedure to execute. The name is shown as the name of a
150
+ button on the error pages. Once clicked, it will invoke the given
151
+ procedure.
83
152
 
84
- URI.unescape("\xe3\x83\x90") # => "バ"
85
- URI.unescape("%E3%83%90") # => "バ"
86
- URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
153
+ *Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
87
154
 
88
- *Ashe Connor*, *Aaron Patterson*
155
+ * Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
89
156
 
157
+ Before:
90
158
 
91
- ## Rails 5.2.1.1 (November 27, 2018) ##
159
+ ("<br />".html_safe * 2).html_safe? #=> nil
92
160
 
93
- * No changes.
161
+ After:
94
162
 
163
+ ("<br />".html_safe * 2).html_safe? #=> true
95
164
 
96
- ## Rails 5.2.1 (August 07, 2018) ##
165
+ *Ryo Nakamura*
97
166
 
98
- * Redis cache store: `delete_matched` no longer blocks the Redis server.
99
- (Switches from evaled Lua to a batched SCAN + DEL loop.)
167
+ * Calling test methods with `with_info_handler` method to allow minitest-hooks
168
+ plugin to work.
100
169
 
101
- *Gleb Mazovetskiy*
170
+ *Mauri Mustonen*
102
171
 
103
- * Fix bug where `ActiveSupport::Timezone.all` would fail when tzinfo data for
104
- any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
172
+ * The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
173
+ longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
174
+ anyway). Experience shows introspection does not have many use cases, and
175
+ troubleshooting is done by logging. With this design trade-off we are able
176
+ to use even less memory in all environments.
105
177
 
106
- *Dominik Sander*
107
-
108
- * Fix bug where `ActiveSupport::Cache` will massively inflate the storage
109
- size when compression is enabled (which is true by default). This patch
110
- does not attempt to repair existing data: please manually flush the cache
111
- to clear out the problematic entries.
178
+ *Xavier Noria*
112
179
 
113
- *Godfrey Chan*
180
+ * Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
181
+ and hence uses less memory when `config.cache_classes` is `true`, a standard
182
+ setup in production.
114
183
 
115
- * Fix `ActiveSupport::Cache#read_multi` bug with local cache enabled that was
116
- returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
184
+ *Xavier Noria*
117
185
 
118
- *Jason Lee*
186
+ * In `:zeitwerk` mode, eager load directories in engines and applications only
187
+ if present in their respective `config.eager_load_paths`.
119
188
 
189
+ A common use case for this is adding `lib` to `config.autoload_paths`, but
190
+ not to `config.eager_load_paths`. In that configuration, for example, files
191
+ in the `lib` directory should not be eager loaded.
120
192
 
121
- ## Rails 5.2.0 (April 09, 2018) ##
193
+ *Xavier Noria*
122
194
 
123
- * Caching: MemCache and Redis `read_multi` and `fetch_multi` speedup.
124
- Read from the local in-memory cache before consulting the backend.
195
+ * Fix bug in Range comparisons when comparing to an excluded-end Range
125
196
 
126
- *Gabriel Sobrinho*
197
+ Before:
127
198
 
128
- * Return all mappings for a timezone identifier in `country_zones`.
199
+ (1..10).cover?(1...11) # => false
129
200
 
130
- Some timezones like `Europe/London` have multiple mappings in
131
- `ActiveSupport::TimeZone::MAPPING` so return all of them instead
132
- of the first one found by using `Hash#value`. e.g:
201
+ After:
133
202
 
134
- # Before
135
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
203
+ (1..10).cover?(1...11) # => true
136
204
 
137
- # After
138
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
205
+ With the same change for `Range#include?` and `Range#===`.
139
206
 
140
- Fixes #31668.
207
+ *Owen Stephens*
141
208
 
142
- *Andrew White*
209
+ * Use weak references in descendants tracker to allow anonymous subclasses to
210
+ be garbage collected.
143
211
 
144
- * Add support for connection pooling on RedisCacheStore.
212
+ *Edgars Beigarts*
145
213
 
146
- *fatkodima*
214
+ * Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
215
+ passing a block optional. This will let users use
216
+ `ActiveSupport::Notifications` messaging features outside of
217
+ instrumentation.
147
218
 
148
- * Support hash as first argument in `assert_difference`. This allows to specify multiple
149
- numeric differences in the same assertion.
219
+ *Ali Ibrahim*
150
220
 
151
- assert_difference ->{ Article.count } => 1, ->{ Post.count } => 2
221
+ * Fix `Time#advance` to work with dates before 1001-03-07
152
222
 
153
- *Julien Meichelbeck*
154
-
155
- * Add missing instrumentation for `read_multi` in `ActiveSupport::Cache::Store`.
223
+ Before:
156
224
 
157
- *Ignatius Reza Lesmana*
225
+ Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
158
226
 
159
- * `assert_changes` will always assert that the expression changes,
160
- regardless of `from:` and `to:` argument combinations.
227
+ After
161
228
 
162
- *Daniel Ma*
229
+ Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
163
230
 
164
- * Use SHA-1 to generate non-sensitive digests, such as the ETag header.
231
+ Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
165
232
 
166
- Enabled by default for new apps; upgrading apps can opt in by setting
167
- `config.active_support.use_sha1_digests = true`.
233
+ *Andrew White*
168
234
 
169
- *Dmitri Dolguikh*, *Eugene Kenny*
235
+ * In Zeitwerk mode, engines are now managed by the `main` autoloader. Engines may reference application constants, if the application is reloaded and we do not reload engines, they won't use the reloaded application code.
170
236
 
171
- * Changed default behaviour of `ActiveSupport::SecurityUtils.secure_compare`,
172
- to make it not leak length information even for variable length string.
237
+ *Xavier Noria*
173
238
 
174
- Renamed old `ActiveSupport::SecurityUtils.secure_compare` to `fixed_length_secure_compare`,
175
- and started raising `ArgumentError` in case of length mismatch of passed strings.
239
+ * Add support for supplying `locale` to `transliterate` and `parameterize`.
176
240
 
177
- *Vipul A M*
241
+ I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
178
242
 
179
- * Make `ActiveSupport::TimeZone.all` return only time zones that are in
180
- `ActiveSupport::TimeZone::MAPPING`.
243
+ ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
244
+ "Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
245
+ ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
181
246
 
182
- Fixes #7245.
247
+ *Kaan Ozkan*, *Sharang Dashputre*
183
248
 
184
- *Chris LaRose*
249
+ * Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
185
250
 
186
- * MemCacheStore: Support expiring counters.
251
+ [ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
187
252
 
188
- Pass `expires_in: [seconds]` to `#increment` and `#decrement` options
189
- to set the Memcached TTL (time-to-live) if the counter doesn't exist.
190
- If the counter exists, Memcached doesn't extend its expiry when it's
191
- incremented or decremented.
253
+ *DHH*
192
254
 
193
- ```
194
- Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
195
- ```
255
+ * Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
256
+ `Array#including` and `Enumerable#including`. Retained the old names as aliases.
196
257
 
197
- *Takumasa Ochi*
258
+ *DHH*
198
259
 
199
- * Handle `TZInfo::AmbiguousTime` errors.
260
+ * Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
200
261
 
201
- Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous
202
- times by choosing the later period, e.g.
262
+ [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
263
+ post.authors.including(Current.person) # => All the authors plus the current person!
203
264
 
204
- Ruby:
205
- ```
206
- ENV["TZ"] = "Europe/Moscow"
207
- Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
208
- ```
265
+ *DHH*
209
266
 
210
- Before:
211
- ```
212
- >> "2014-10-26 01:00:00".in_time_zone("Moscow")
213
- TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
214
- ```
215
267
 
216
- After:
217
- ```
218
- >> "2014-10-26 01:00:00".in_time_zone("Moscow")
219
- => Sun, 26 Oct 2014 01:00:00 MSK +03:00
220
- ```
268
+ ## Rails 6.0.0.beta3 (March 11, 2019) ##
221
269
 
222
- Fixes #17395.
270
+ * No changes.
223
271
 
224
- *Andrew White*
225
272
 
226
- * Redis cache store.
273
+ ## Rails 6.0.0.beta2 (February 25, 2019) ##
227
274
 
228
- ```
229
- # Defaults to `redis://localhost:6379/0`. Only use for dev/test.
230
- config.cache_store = :redis_cache_store
231
-
232
- # Supports all common cache store options (:namespace, :compress,
233
- # :compress_threshold, :expires_in, :race_condition_ttl) and all
234
- # Redis options.
235
- cache_password = Rails.application.secrets.redis_cache_password
236
- config.cache_store = :redis_cache_store, driver: :hiredis,
237
- namespace: 'myapp-cache', compress: true, timeout: 1,
238
- url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
239
-
240
- # Supports Redis::Distributed with multiple hosts
241
- config.cache_store = :redis_cache_store, driver: :hiredis
242
- namespace: 'myapp-cache', compress: true,
243
- url: %w[
244
- redis://myapp-cache-1:6379/0
245
- redis://myapp-cache-1:6380/0
246
- redis://myapp-cache-2:6379/0
247
- redis://myapp-cache-2:6380/0
248
- redis://myapp-cache-3:6379/0
249
- redis://myapp-cache-3:6380/0
250
- ]
251
-
252
- # Or pass a builder block
253
- config.cache_store = :redis_cache_store,
254
- namespace: 'myapp-cache', compress: true,
255
- redis: -> { Redis.new … }
256
- ```
275
+ * New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
257
276
 
258
- Deployment note: Take care to use a *dedicated Redis cache* rather
259
- than pointing this at your existing Redis server. It won't cope well
260
- with mixed usage patterns and it won't expire cache entries by default.
277
+ *Xavier Noria*
261
278
 
262
- Redis cache server setup guide: https://redis.io/topics/lru-cache
279
+ * Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
263
280
 
264
- *Jeremy Daer*
281
+ *Zach Kemp*
265
282
 
266
- * Cache: Enable compression by default for values > 1kB.
283
+ * Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
267
284
 
268
- Compression has long been available, but opt-in and at a 16kB threshold.
269
- It wasn't enabled by default due to CPU cost. Today it's cheap and typical
270
- cache data is eminently compressible, such as HTML or JSON fragments.
271
- Compression dramatically reduces Memcached/Redis mem usage, which means
272
- the same cache servers can store more data, which means higher hit rates.
285
+ *Rosa Gutierrez*
273
286
 
274
- To disable compression, pass `compress: false` to the initializer.
287
+ * Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
275
288
 
276
- *Jeremy Daer*
289
+ *Akinori Musha*
277
290
 
278
- * Allow `Range#include?` on TWZ ranges.
291
+ * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
279
292
 
280
- In #11474 we prevented TWZ ranges being iterated over which matched
281
- Ruby's handling of Time ranges and as a consequence `include?`
282
- stopped working with both Time ranges and TWZ ranges. However in
283
- ruby/ruby@b061634 support was added for `include?` to use `cover?`
284
- for 'linear' objects. Since we have no way of making Ruby consider
285
- TWZ instances as 'linear' we have to override `Range#include?`.
293
+ `assoc` can now be called with either a string or a symbol.
286
294
 
287
- Fixes #30799.
295
+ *Stefan Schüßler*
288
296
 
289
- *Andrew White*
297
+ * Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
290
298
 
291
- * Fix acronym support in `humanize`.
299
+ *Guillermo Iguaran*
292
300
 
293
- Acronym inflections are stored with lowercase keys in the hash but
294
- the match wasn't being lowercased before being looked up in the hash.
295
- This shouldn't have any performance impact because before it would
296
- fail to find the acronym and perform the `downcase` operation anyway.
297
301
 
298
- Fixes #31052.
302
+ ## Rails 6.0.0.beta1 (January 18, 2019) ##
299
303
 
300
- *Andrew White*
304
+ * Remove deprecated `Module#reachable?` method.
301
305
 
302
- * Add same method signature for `Time#prev_year` and `Time#next_year`
303
- in accordance with `Date#prev_year`, `Date#next_year`.
306
+ *Rafael Mendonça França*
304
307
 
305
- Allows pass argument for `Time#prev_year` and `Time#next_year`.
308
+ * Remove deprecated `#acronym_regex` method from `Inflections`.
306
309
 
307
- Before:
308
- ```
309
- Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
310
- Time.new(2017, 9, 16, 17, 0).prev_year(1)
311
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
310
+ *Rafael Mendonça França*
312
311
 
313
- Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
314
- Time.new(2017, 9, 16, 17, 0).next_year(1)
315
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
316
- ```
312
+ * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
317
313
 
318
- After:
319
- ```
320
- Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
321
- Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
314
+ *Keenan Brock*
322
315
 
323
- Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
324
- Time.new(2017, 9, 16, 17, 0).next_year(1) # => 2018-09-16 17:00:00 +0300
325
- ```
316
+ * Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
326
317
 
327
- *bogdanvlviv*
318
+ `fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
328
319
 
329
- * Add same method signature for `Time#prev_month` and `Time#next_month`
330
- in accordance with `Date#prev_month`, `Date#next_month`.
320
+ *Gannon McGibbon*
331
321
 
332
- Allows pass argument for `Time#prev_month` and `Time#next_month`.
322
+ * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
333
323
 
334
- Before:
335
- ```
336
- Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
337
- Time.new(2017, 9, 16, 17, 0).prev_month(1)
338
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
324
+ *Mark J. Titorenko*, *Vlad Bokov*
339
325
 
340
- Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
341
- Time.new(2017, 9, 16, 17, 0).next_month(1)
342
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
343
- ```
326
+ * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
327
+ would not act as alias for `#symbolize_keys`.
344
328
 
345
- After:
346
- ```
347
- Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
348
- Time.new(2017, 9, 16, 17, 0).prev_month(1) # => 2017-08-16 17:00:00 +0300
329
+ *Nick Weiland*
349
330
 
350
- Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
351
- Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
352
- ```
331
+ * Improve the logic that detects non-autoloaded constants.
353
332
 
354
- *bogdanvlviv*
333
+ *Jan Habermann*, *Xavier Noria*
355
334
 
356
- * Add same method signature for `Time#prev_day` and `Time#next_day`
357
- in accordance with `Date#prev_day`, `Date#next_day`.
335
+ * Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSuppport::Multibyte::Unicode#unpack_graphemes(string)`
336
+ in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
358
337
 
359
- Allows pass argument for `Time#prev_day` and `Time#next_day`.
338
+ *Francesco Rodríguez*
360
339
 
361
- Before:
362
- ```
363
- Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
364
- Time.new(2017, 9, 16, 17, 0).prev_day(1)
365
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
340
+ * Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
366
341
 
367
- Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
368
- Time.new(2017, 9, 16, 17, 0).next_day(1)
369
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
370
- ```
342
+ *Francesco Rodríguez*
371
343
 
372
- After:
344
+ * Fix duration being rounded to a full second.
373
345
  ```
374
- Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
375
- Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
376
-
377
- Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
378
- Time.new(2017, 9, 16, 17, 0).next_day(1) # => 2017-09-17 17:00:00 +0300
346
+ time = DateTime.parse("2018-1-1")
347
+ time += 0.51.seconds
379
348
  ```
349
+ Will now correctly add 0.51 second and not 1 full second.
380
350
 
381
- *bogdanvlviv*
351
+ *Edouard Chin*
382
352
 
383
- * `IO#to_json` now returns the `to_s` representation, rather than
384
- attempting to convert to an array. This fixes a bug where `IO#to_json`
385
- would raise an `IOError` when called on an unreadable object.
353
+ * Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSuppport::Multibyte::Chars#normalize`
354
+ in favor of `String#unicode_normalize`
386
355
 
387
- Fixes #26132.
356
+ *Francesco Rodríguez*
388
357
 
389
- *Paul Kuruvilla*
358
+ * Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
359
+ `String#downcase/upcase/swapcase`.
390
360
 
391
- * Remove deprecated `halt_callback_chains_on_return_false` option.
361
+ *Francesco Rodríguez*
392
362
 
393
- *Rafael Mendonça França*
363
+ * Add `ActiveSupport::ParameterFilter`.
394
364
 
395
- * Remove deprecated `:if` and `:unless` string filter for callbacks.
365
+ *Yoshiyuki Kinjo*
396
366
 
397
- *Rafael Mendonça França*
398
-
399
- * `Hash#slice` now falls back to Ruby 2.5+'s built-in definition if defined.
400
-
401
- *Akira Matsuda*
367
+ * Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
368
+ `module_parent`, `module_parents`, and `module_parent_name`.
402
369
 
403
- * Deprecate `secrets.secret_token`.
370
+ *Gannon McGibbon*
404
371
 
405
- The architecture for secrets had a big upgrade between Rails 3 and Rails 4,
406
- when the default changed from using `secret_token` to `secret_key_base`.
372
+ * Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
407
373
 
408
- `secret_token` has been soft deprecated in documentation for four years
409
- but is still in place to support apps created before Rails 4.
410
- Deprecation warnings have been added to help developers upgrade their
411
- applications to `secret_key_base`.
374
+ *Edouard Chin*
412
375
 
413
- *claudiob*, *Kasper Timm Hansen*
376
+ * Deprecate using negative limits in `String#first` and `String#last`.
414
377
 
415
- * Return an instance of `HashWithIndifferentAccess` from `HashWithIndifferentAccess#transform_keys`.
378
+ *Gannon McGibbon*, *Eric Turner*
416
379
 
417
- *Yuji Yaginuma*
380
+ * Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
381
+ with symbol arguments
418
382
 
419
- * Add key rotation support to `MessageEncryptor` and `MessageVerifier`.
383
+ *Abraham Chan*
420
384
 
421
- This change introduces a `rotate` method to both the `MessageEncryptor` and
422
- `MessageVerifier` classes. This method accepts the same arguments and
423
- options as the given classes' constructor. The `encrypt_and_verify` method
424
- for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
425
- accept an optional keyword argument `:on_rotation` block which is called
426
- when a rotated instance is used to decrypt or verify the message.
385
+ * Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
386
+ Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
427
387
 
428
- *Michael J Coyne*
429
-
430
- * Deprecate `Module#reachable?` method.
431
-
432
- *bogdanvlviv*
388
+ *Janosch Müller*
433
389
 
434
- * Add `config/credentials.yml.enc` to store production app secrets.
390
+ * Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
391
+ of mutating the one received as parameter.
435
392
 
436
- Allows saving any authentication credentials for third party services
437
- directly in repo encrypted with `config/master.key` or `ENV["RAILS_MASTER_KEY"]`.
393
+ *Thierry Joyal*
438
394
 
439
- This will eventually replace `Rails.application.secrets` and the encrypted
440
- secrets introduced in Rails 5.1.
395
+ * Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
441
396
 
442
- *DHH*, *Kasper Timm Hansen*
397
+ The alias is provided for symmetry with `freeze_time`.
443
398
 
444
- * Add `ActiveSupport::EncryptedFile` and `ActiveSupport::EncryptedConfiguration`.
399
+ *Ryan Davidson*
445
400
 
446
- Allows for stashing encrypted files or configuration directly in repo by
447
- encrypting it with a key.
401
+ * Add support for tracing constant autoloads. Just throw
448
402
 
449
- Backs the new credentials setup above, but can also be used independently.
403
+ ActiveSupport::Dependencies.logger = Rails.logger
404
+ ActiveSupport::Dependencies.verbose = true
450
405
 
451
- *DHH*, *Kasper Timm Hansen*
406
+ in an initializer.
452
407
 
453
- * `Module#delegate_missing_to` now raises `DelegationError` if target is nil,
454
- similar to `Module#delegate`.
408
+ *Xavier Noria*
455
409
 
456
- *Anton Khamets*
410
+ * Maintain `html_safe?` on html_safe strings when sliced.
457
411
 
458
- * Update `String#camelize` to provide feedback when wrong option is passed.
412
+ string = "<div>test</div>".html_safe
413
+ string[-1..1].html_safe? # => true
459
414
 
460
- `String#camelize` was returning nil without any feedback when an
461
- invalid option was passed as a parameter.
415
+ *Elom Gomez*, *Yumin Wong*
462
416
 
463
- Previously:
417
+ * Add `Array#extract!`.
464
418
 
465
- 'one_two'.camelize(true)
466
- # => nil
419
+ The method removes and returns the elements for which the block returns a true value.
420
+ If no block is given, an Enumerator is returned instead.
467
421
 
468
- Now:
422
+ numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
423
+ odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
424
+ numbers # => [0, 2, 4, 6, 8]
469
425
 
470
- 'one_two'.camelize(true)
471
- # => ArgumentError: Invalid option, use either :upper or :lower.
472
-
473
- *Ricardo Díaz*
474
-
475
- * Fix modulo operations involving durations.
476
-
477
- Rails 5.1 introduced `ActiveSupport::Duration::Scalar` as a wrapper
478
- around numeric values as a way of ensuring a duration was the outcome of
479
- an expression. However, the implementation was missing support for modulo
480
- operations. This support has now been added and should result in a duration
481
- being returned from expressions involving modulo operations.
426
+ *bogdanvlviv*
482
427
 
483
- Prior to Rails 5.1:
428
+ * Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
484
429
 
485
- 5.minutes % 2.minutes
486
- # => 60
430
+ cache.fetch('bar', skip_nil: true) { nil }
431
+ cache.exist?('bar') # => false
487
432
 
488
- Now:
433
+ *Martin Hong*
489
434
 
490
- 5.minutes % 2.minutes
491
- # => 1 minute
435
+ * Add "event object" support to the notification system.
436
+ Before this change, end users were forced to create hand made artisanal
437
+ event objects on their own, like this:
492
438
 
493
- Fixes #29603 and #29743.
439
+ ActiveSupport::Notifications.subscribe('wait') do |*args|
440
+ @event = ActiveSupport::Notifications::Event.new(*args)
441
+ end
494
442
 
495
- *Sayan Chakraborty*, *Andrew White*
443
+ ActiveSupport::Notifications.instrument('wait') do
444
+ sleep 1
445
+ end
496
446
 
497
- * Fix division where a duration is the denominator.
447
+ @event.duration # => 1000.138
498
448
 
499
- PR #29163 introduced a change in behavior when a duration was the denominator
500
- in a calculation - this was incorrect as dividing by a duration should always
501
- return a `Numeric`. The behavior of previous versions of Rails has been restored.
449
+ After this change, if the block passed to `subscribe` only takes one
450
+ parameter, the framework will yield an event object to the block. Now
451
+ end users are no longer required to make their own:
502
452
 
503
- Fixes #29592.
453
+ ActiveSupport::Notifications.subscribe('wait') do |event|
454
+ @event = event
455
+ end
504
456
 
505
- *Andrew White*
457
+ ActiveSupport::Notifications.instrument('wait') do
458
+ sleep 1
459
+ end
506
460
 
507
- * Add purpose and expiry support to `ActiveSupport::MessageVerifier` and
508
- `ActiveSupport::MessageEncryptor`.
461
+ p @event.allocations # => 7
462
+ p @event.cpu_time # => 0.256
463
+ p @event.idle_time # => 1003.2399
509
464
 
510
- For instance, to ensure a message is only usable for one intended purpose:
465
+ Now you can enjoy event objects without making them yourself. Neat!
511
466
 
512
- token = @verifier.generate("x", purpose: :shipping)
467
+ *Aaron "t.lo" Patterson*
513
468
 
514
- @verifier.verified(token, purpose: :shipping) # => "x"
515
- @verifier.verified(token) # => nil
469
+ * Add cpu_time, idle_time, and allocations to Event.
516
470
 
517
- Or make it expire after a set time:
471
+ *Eileen M. Uchitelle*, *Aaron Patterson*
518
472
 
519
- @verifier.generate("x", expires_in: 1.month)
520
- @verifier.generate("y", expires_at: Time.now.end_of_year)
473
+ * RedisCacheStore: support key expiry in increment/decrement.
521
474
 
522
- Showcased with `ActiveSupport::MessageVerifier`, but works the same for
523
- `ActiveSupport::MessageEncryptor`'s `encrypt_and_sign` and `decrypt_and_verify`.
475
+ Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
524
476
 
525
- Pull requests: #29599, #29854
477
+ If the key is already set to expire, RedisCacheStore won't extend its expiry.
526
478
 
527
- *Assain Jaleel*
479
+ Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
528
480
 
529
- * Make the order of `Hash#reverse_merge!` consistent with `HashWithIndifferentAccess`.
481
+ *Jason Lee*
530
482
 
531
- *Erol Fornoles*
483
+ * Allow `Range#===` and `Range#cover?` on Range.
532
484
 
533
- * Add `freeze_time` helper which freezes time to `Time.now` in tests.
485
+ `Range#cover?` can now accept a range argument like `Range#include?` and
486
+ `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
487
+ into a new file, with these two methods.
534
488
 
535
- *Prathamesh Sonpatki*
489
+ *Requiring active_support/core_ext/range/include_range is now deprecated.*
490
+ *Use `require "active_support/core_ext/range/compare_range"` instead.*
536
491
 
537
- * Default `ActiveSupport::MessageEncryptor` to use AES 256 GCM encryption.
492
+ *utilum*
538
493
 
539
- On for new Rails 5.2 apps. Upgrading apps can find the config as a new
540
- framework default.
494
+ * Add `index_with` to Enumerable.
541
495
 
542
- *Assain Jaleel*
496
+ Allows creating a hash from an enumerable with the value from a passed block
497
+ or a default argument.
543
498
 
544
- * Cache: `write_multi`.
499
+ %i( title body ).index_with { |attr| post.public_send(attr) }
500
+ # => { title: "hey", body: "what's up?" }
545
501
 
546
- Rails.cache.write_multi foo: 'bar', baz: 'qux'
502
+ %i( title body ).index_with(nil)
503
+ # => { title: nil, body: nil }
547
504
 
548
- Plus faster fetch_multi with stores that implement `write_multi_entries`.
549
- Keys that aren't found may be written to the cache store in one shot
550
- instead of separate writes.
505
+ Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
551
506
 
552
- The default implementation simply calls `write_entry` for each entry.
553
- Stores may override if they're capable of one-shot bulk writes, like
554
- Redis `MSET`.
507
+ *Kasper Timm Hansen*
555
508
 
556
- *Jeremy Daer*
509
+ * Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
510
+ any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
557
511
 
558
- * Add default option to module and class attribute accessors.
512
+ *Dominik Sander*
559
513
 
560
- mattr_accessor :settings, default: {}
514
+ * Redis cache store: `delete_matched` no longer blocks the Redis server.
515
+ (Switches from evaled Lua to a batched SCAN + DEL loop.)
561
516
 
562
- Works for `mattr_reader`, `mattr_writer`, `cattr_accessor`, `cattr_reader`,
563
- and `cattr_writer` as well.
517
+ *Gleb Mazovetskiy*
564
518
 
565
- *Genadi Samokovarov*
519
+ * Fix bug where `ActiveSupport::Cache` will massively inflate the storage
520
+ size when compression is enabled (which is true by default). This patch
521
+ does not attempt to repair existing data: please manually flush the cache
522
+ to clear out the problematic entries.
566
523
 
567
- * Add `Date#prev_occurring` and `Date#next_occurring` to return specified next/previous occurring day of week.
524
+ *Godfrey Chan*
568
525
 
569
- *Shota Iguchi*
526
+ * Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
570
527
 
571
- * Add default option to `class_attribute`.
528
+ URI.unescape("\xe3\x83\x90") # => "バ"
529
+ URI.unescape("%E3%83%90") # => "バ"
530
+ URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
572
531
 
573
- Before:
532
+ *Ashe Connor*, *Aaron Patterson*
574
533
 
575
- class_attribute :settings
576
- self.settings = {}
534
+ * Add `before?` and `after?` methods to `Date`, `DateTime`,
535
+ `Time`, and `TimeWithZone`.
577
536
 
578
- Now:
537
+ *Nick Holden*
579
538
 
580
- class_attribute :settings, default: {}
539
+ * `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
540
+ translations through I18n.
581
541
 
582
- *DHH*
542
+ # locale/fr.rb
583
543
 
584
- * `#singularize` and `#pluralize` now respect uncountables for the specified locale.
544
+ {
545
+ fr: {
546
+ number: {
547
+ nth: {
548
+ ordinals: lambda do |_key, number:, **_options|
549
+ if number.to_i.abs == 1
550
+ 'er'
551
+ else
552
+ 'e'
553
+ end
554
+ end,
585
555
 
586
- *Eilis Hamilton*
556
+ ordinalized: lambda do |_key, number:, **_options|
557
+ "#{number}#{ActiveSupport::Inflector.ordinal(number)}"
558
+ end
559
+ }
560
+ }
561
+ }
562
+ }
587
563
 
588
- * Add `ActiveSupport::CurrentAttributes` to provide a thread-isolated attributes singleton.
589
- Primary use case is keeping all the per-request attributes easily available to the whole system.
590
564
 
591
- *DHH*
565
+ *Christian Blais*
592
566
 
593
- * Fix implicit coercion calculations with scalars and durations.
567
+ * Add `:private` option to ActiveSupport's `Module#delegate`
568
+ in order to delegate methods as private:
594
569
 
595
- Previously, calculations where the scalar is first would be converted to a duration
596
- of seconds, but this causes issues with dates being converted to times, e.g:
570
+ class User < ActiveRecord::Base
571
+ has_one :profile
572
+ delegate :date_of_birth, to: :profile, private: true
597
573
 
598
- Time.zone = "Beijing" # => Asia/Shanghai
599
- date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
600
- 2 * 1.day # => 172800 seconds
601
- date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
574
+ def age
575
+ Date.today.year - date_of_birth.year
576
+ end
577
+ end
602
578
 
603
- Now, the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain
604
- the part structure of the duration where possible, e.g:
579
+ # User.new.age # => 29
580
+ # User.new.date_of_birth
581
+ # => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
605
582
 
606
- Time.zone = "Beijing" # => Asia/Shanghai
607
- date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
608
- 2 * 1.day # => 2 days
609
- date + 2 * 1.day # => Mon, 22 May 2017
583
+ *Tomas Valent*
610
584
 
611
- Fixes #29160, #28970.
585
+ * `String#truncate_bytes` to truncate a string to a maximum bytesize without
586
+ breaking multibyte characters or grapheme clusters like 👩‍👩‍👦‍👦.
612
587
 
613
- *Andrew White*
588
+ *Jeremy Daer*
614
589
 
615
- * Add support for versioned cache entries. This enables the cache stores to recycle cache keys, greatly saving
616
- on storage in cases with frequent churn. Works together with the separation of `#cache_key` and `#cache_version`
617
- in Active Record and its use in Action Pack's fragment caching.
590
+ * `String#strip_heredoc` preserves frozenness.
618
591
 
619
- *DHH*
592
+ "foo".freeze.strip_heredoc.frozen? # => true
620
593
 
621
- * Pass gem name and deprecation horizon to deprecation notifications.
594
+ Fixes that frozen string literals would inadvertently become unfrozen:
622
595
 
623
- *Willem van Bergen*
596
+ # frozen_string_literal: true
624
597
 
625
- * Add support for `:offset` and `:zone` to `ActiveSupport::TimeWithZone#change`.
598
+ foo = <<-MSG.strip_heredoc
599
+ la la la
600
+ MSG
626
601
 
627
- *Andrew White*
602
+ foo.frozen? # => false !??
628
603
 
629
- * Add support for `:offset` to `Time#change`.
604
+ *Jeremy Daer*
630
605
 
631
- Fixes #28723.
606
+ * Rails 6 requires Ruby 2.5.0 or newer.
632
607
 
633
- *Andrew White*
608
+ *Jeremy Daer*, *Kasper Timm Hansen*
634
609
 
635
- * Add `fetch_values` for `HashWithIndifferentAccess`.
610
+ * Adds parallel testing to Rails.
636
611
 
637
- The method was originally added to `Hash` in Ruby 2.3.0.
612
+ Parallelize your test suite with forked processes or threads.
638
613
 
639
- *Josh Pencheon*
614
+ *Eileen M. Uchitelle*, *Aaron Patterson*
640
615
 
641
616
 
642
- Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/activesupport/CHANGELOG.md) for previous changes.
617
+ Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.