activesupport 4.0.12 → 7.0.2.4
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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +249 -501
- data/MIT-LICENSE +2 -2
- data/README.rdoc +10 -5
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/all.rb +5 -3
- data/lib/active_support/array_inquirer.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +41 -13
- data/lib/active_support/benchmarkable.rb +7 -15
- data/lib/active_support/builder.rb +3 -1
- data/lib/active_support/cache/file_store.rb +96 -74
- data/lib/active_support/cache/mem_cache_store.rb +211 -103
- data/lib/active_support/cache/memory_store.rb +90 -58
- data/lib/active_support/cache/null_store.rb +19 -7
- data/lib/active_support/cache/redis_cache_store.rb +468 -0
- data/lib/active_support/cache/strategy/local_cache.rb +86 -83
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +45 -0
- data/lib/active_support/cache.rb +580 -241
- data/lib/active_support/callbacks.rb +812 -425
- data/lib/active_support/code_generator.rb +65 -0
- data/lib/active_support/concern.rb +103 -14
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +33 -0
- data/lib/active_support/concurrency/share_lock.rb +226 -0
- data/lib/active_support/configurable.rb +21 -19
- data/lib/active_support/configuration_file.rb +51 -0
- data/lib/active_support/core_ext/array/access.rb +47 -1
- data/lib/active_support/core_ext/array/conversions.rb +35 -44
- data/lib/active_support/core_ext/array/deprecated_conversions.rb +25 -0
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/extract_options.rb +2 -0
- data/lib/active_support/core_ext/array/grouping.rb +26 -16
- data/lib/active_support/core_ext/array/inquiry.rb +19 -0
- data/lib/active_support/core_ext/array/wrap.rb +7 -4
- data/lib/active_support/core_ext/array.rb +10 -7
- data/lib/active_support/core_ext/benchmark.rb +5 -3
- data/lib/active_support/core_ext/big_decimal/conversions.rb +9 -26
- data/lib/active_support/core_ext/big_decimal.rb +3 -1
- data/lib/active_support/core_ext/class/attribute.rb +52 -49
- data/lib/active_support/core_ext/class/attribute_accessors.rb +5 -169
- data/lib/active_support/core_ext/class/subclasses.rb +25 -26
- data/lib/active_support/core_ext/class.rb +4 -4
- data/lib/active_support/core_ext/date/acts_like.rb +3 -1
- data/lib/active_support/core_ext/date/blank.rb +14 -0
- data/lib/active_support/core_ext/date/calculations.rb +31 -18
- data/lib/active_support/core_ext/date/conversions.rb +43 -32
- data/lib/active_support/core_ext/date/deprecated_conversions.rb +26 -0
- data/lib/active_support/core_ext/date/zones.rb +5 -34
- data/lib/active_support/core_ext/date.rb +7 -4
- data/lib/active_support/core_ext/date_and_time/calculations.rb +198 -66
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +31 -0
- data/lib/active_support/core_ext/date_and_time/zones.rb +40 -0
- data/lib/active_support/core_ext/date_time/acts_like.rb +4 -2
- data/lib/active_support/core_ext/date_time/blank.rb +14 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +79 -38
- data/lib/active_support/core_ext/date_time/compatibility.rb +18 -0
- data/lib/active_support/core_ext/date_time/conversions.rb +31 -26
- data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +22 -0
- data/lib/active_support/core_ext/date_time.rb +8 -4
- data/lib/active_support/core_ext/digest/uuid.rb +79 -0
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +249 -17
- data/lib/active_support/core_ext/file/atomic.rb +41 -32
- data/lib/active_support/core_ext/file.rb +3 -1
- data/lib/active_support/core_ext/hash/conversions.rb +71 -49
- data/lib/active_support/core_ext/hash/deep_merge.rb +9 -13
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +14 -5
- data/lib/active_support/core_ext/hash/indifferent_access.rb +5 -3
- data/lib/active_support/core_ext/hash/keys.rb +39 -56
- data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
- data/lib/active_support/core_ext/hash/slice.rb +8 -23
- data/lib/active_support/core_ext/hash.rb +10 -8
- data/lib/active_support/core_ext/integer/inflections.rb +3 -1
- data/lib/active_support/core_ext/integer/multiple.rb +3 -1
- data/lib/active_support/core_ext/integer/time.rb +11 -33
- data/lib/active_support/core_ext/integer.rb +5 -3
- data/lib/active_support/core_ext/kernel/concern.rb +14 -0
- data/lib/active_support/core_ext/kernel/reporting.rb +9 -78
- data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
- data/lib/active_support/core_ext/kernel.rb +5 -4
- data/lib/active_support/core_ext/load_error.rb +5 -21
- data/lib/active_support/core_ext/module/aliasing.rb +6 -44
- data/lib/active_support/core_ext/module/anonymous.rb +12 -1
- data/lib/active_support/core_ext/module/attr_internal.rb +8 -8
- data/lib/active_support/core_ext/module/attribute_accessors.rb +186 -44
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +157 -0
- data/lib/active_support/core_ext/module/concerning.rb +140 -0
- data/lib/active_support/core_ext/module/delegation.rb +172 -45
- data/lib/active_support/core_ext/module/deprecation.rb +3 -3
- data/lib/active_support/core_ext/module/introspection.rb +23 -38
- data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
- data/lib/active_support/core_ext/module/remove_method.rb +8 -3
- data/lib/active_support/core_ext/module.rb +13 -10
- data/lib/active_support/core_ext/name_error.rb +45 -4
- data/lib/active_support/core_ext/numeric/bytes.rb +22 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +135 -127
- data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +60 -0
- data/lib/active_support/core_ext/numeric/time.rb +37 -50
- data/lib/active_support/core_ext/numeric.rb +6 -3
- data/lib/active_support/core_ext/object/acts_like.rb +41 -6
- data/lib/active_support/core_ext/object/blank.rb +70 -20
- data/lib/active_support/core_ext/object/conversions.rb +6 -4
- data/lib/active_support/core_ext/object/deep_dup.rb +19 -10
- data/lib/active_support/core_ext/object/duplicable.rb +17 -47
- data/lib/active_support/core_ext/object/inclusion.rb +18 -15
- data/lib/active_support/core_ext/object/instance_variables.rb +3 -1
- data/lib/active_support/core_ext/object/json.rb +244 -0
- data/lib/active_support/core_ext/object/to_param.rb +3 -1
- data/lib/active_support/core_ext/object/to_query.rb +21 -8
- data/lib/active_support/core_ext/object/try.rb +106 -26
- data/lib/active_support/core_ext/object/with_options.rb +64 -5
- data/lib/active_support/core_ext/object.rb +14 -12
- data/lib/active_support/core_ext/pathname/existence.rb +21 -0
- data/lib/active_support/core_ext/pathname.rb +3 -0
- data/lib/active_support/core_ext/range/compare_range.rb +57 -0
- data/lib/active_support/core_ext/range/conversions.rb +37 -15
- data/lib/active_support/core_ext/range/deprecated_conversions.rb +26 -0
- data/lib/active_support/core_ext/range/each.rb +18 -17
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +7 -0
- data/lib/active_support/core_ext/range/overlaps.rb +2 -0
- data/lib/active_support/core_ext/range.rb +7 -4
- data/lib/active_support/core_ext/regexp.rb +10 -1
- data/lib/active_support/core_ext/securerandom.rb +45 -0
- data/lib/active_support/core_ext/string/access.rb +42 -51
- data/lib/active_support/core_ext/string/behavior.rb +3 -1
- data/lib/active_support/core_ext/string/conversions.rb +18 -13
- data/lib/active_support/core_ext/string/exclude.rb +5 -3
- data/lib/active_support/core_ext/string/filters.rb +97 -7
- data/lib/active_support/core_ext/string/indent.rb +6 -4
- data/lib/active_support/core_ext/string/inflections.rb +106 -25
- data/lib/active_support/core_ext/string/inquiry.rb +4 -1
- data/lib/active_support/core_ext/string/multibyte.rb +18 -9
- data/lib/active_support/core_ext/string/output_safety.rb +227 -54
- data/lib/active_support/core_ext/string/starts_ends_with.rb +4 -2
- data/lib/active_support/core_ext/string/strip.rb +6 -5
- data/lib/active_support/core_ext/string/zones.rb +4 -1
- data/lib/active_support/core_ext/string.rb +15 -13
- data/lib/active_support/core_ext/symbol/starts_ends_with.rb +6 -0
- data/lib/active_support/core_ext/symbol.rb +3 -0
- data/lib/active_support/core_ext/time/acts_like.rb +3 -1
- data/lib/active_support/core_ext/time/calculations.rb +178 -116
- data/lib/active_support/core_ext/time/compatibility.rb +16 -0
- data/lib/active_support/core_ext/time/conversions.rb +37 -25
- data/lib/active_support/core_ext/time/deprecated_conversions.rb +22 -0
- data/lib/active_support/core_ext/time/zones.rb +44 -42
- data/lib/active_support/core_ext/time.rb +8 -5
- data/lib/active_support/core_ext/uri.rb +4 -25
- data/lib/active_support/core_ext.rb +4 -2
- data/lib/active_support/current_attributes/test_helper.rb +13 -0
- data/lib/active_support/current_attributes.rb +226 -0
- data/lib/active_support/dependencies/autoload.rb +3 -1
- data/lib/active_support/dependencies/interlock.rb +49 -0
- data/lib/active_support/dependencies/require_dependency.rb +28 -0
- data/lib/active_support/dependencies.rb +71 -696
- data/lib/active_support/deprecation/behaviors.rb +65 -16
- data/lib/active_support/deprecation/constant_accessor.rb +52 -0
- data/lib/active_support/deprecation/disallowed.rb +56 -0
- data/lib/active_support/deprecation/instance_delegator.rb +16 -2
- data/lib/active_support/deprecation/method_wrappers.rb +62 -21
- data/lib/active_support/deprecation/proxy_wrappers.rb +82 -31
- data/lib/active_support/deprecation/reporting.rb +81 -18
- data/lib/active_support/deprecation.rb +19 -11
- data/lib/active_support/descendants_tracker.rb +192 -34
- data/lib/active_support/digest.rb +22 -0
- data/lib/active_support/duration/iso8601_parser.rb +123 -0
- data/lib/active_support/duration/iso8601_serializer.rb +67 -0
- data/lib/active_support/duration.rb +437 -39
- data/lib/active_support/encrypted_configuration.rb +56 -0
- data/lib/active_support/encrypted_file.rb +117 -0
- data/lib/active_support/environment_inquirer.rb +20 -0
- data/lib/active_support/error_reporter.rb +117 -0
- data/lib/active_support/evented_file_update_checker.rb +170 -0
- data/lib/active_support/execution_context/test_helper.rb +13 -0
- data/lib/active_support/execution_context.rb +53 -0
- data/lib/active_support/execution_wrapper.rb +151 -0
- data/lib/active_support/executor/test_helper.rb +7 -0
- data/lib/active_support/executor.rb +8 -0
- data/lib/active_support/file_update_checker.rb +62 -37
- data/lib/active_support/fork_tracker.rb +71 -0
- data/lib/active_support/gem_version.rb +17 -0
- data/lib/active_support/gzip.rb +7 -5
- data/lib/active_support/hash_with_indifferent_access.rb +207 -54
- data/lib/active_support/html_safe_translation.rb +43 -0
- data/lib/active_support/i18n.rb +10 -6
- data/lib/active_support/i18n_railtie.rb +48 -19
- data/lib/active_support/inflections.rb +19 -12
- data/lib/active_support/inflector/inflections.rb +97 -37
- data/lib/active_support/inflector/methods.rb +192 -157
- data/lib/active_support/inflector/transliterate.rb +83 -33
- data/lib/active_support/inflector.rb +7 -5
- data/lib/active_support/isolated_execution_state.rb +64 -0
- data/lib/active_support/json/decoding.rb +37 -42
- data/lib/active_support/json/encoding.rb +93 -293
- data/lib/active_support/json.rb +4 -2
- data/lib/active_support/key_generator.rb +30 -47
- data/lib/active_support/lazy_load_hooks.rb +54 -21
- data/lib/active_support/locale/en.rb +33 -0
- data/lib/active_support/locale/en.yml +10 -4
- data/lib/active_support/log_subscriber/test_helper.rb +14 -12
- data/lib/active_support/log_subscriber.rb +61 -18
- data/lib/active_support/logger.rb +40 -4
- data/lib/active_support/logger_silence.rb +17 -20
- data/lib/active_support/logger_thread_safe_level.rb +69 -0
- data/lib/active_support/message_encryptor.rb +178 -55
- data/lib/active_support/message_verifier.rb +195 -26
- data/lib/active_support/messages/metadata.rb +80 -0
- data/lib/active_support/messages/rotation_configuration.rb +23 -0
- data/lib/active_support/messages/rotator.rb +57 -0
- data/lib/active_support/multibyte/chars.rb +45 -92
- data/lib/active_support/multibyte/unicode.rb +44 -377
- data/lib/active_support/multibyte.rb +5 -3
- data/lib/active_support/notifications/fanout.rb +177 -44
- data/lib/active_support/notifications/instrumenter.rb +117 -17
- data/lib/active_support/notifications.rb +106 -39
- data/lib/active_support/number_helper/number_converter.rb +181 -0
- data/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +30 -0
- data/lib/active_support/number_helper/number_to_human_converter.rb +69 -0
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +60 -0
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +16 -0
- data/lib/active_support/number_helper/number_to_phone_converter.rb +59 -0
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +59 -0
- data/lib/active_support/number_helper/rounding_helper.rb +46 -0
- data/lib/active_support/number_helper.rb +152 -394
- data/lib/active_support/option_merger.rb +18 -5
- data/lib/active_support/ordered_hash.rb +8 -6
- data/lib/active_support/ordered_options.rb +43 -7
- data/lib/active_support/parameter_filter.rb +138 -0
- data/lib/active_support/per_thread_registry.rb +24 -11
- data/lib/active_support/proxy_object.rb +2 -0
- data/lib/active_support/rails.rb +10 -11
- data/lib/active_support/railtie.rb +118 -12
- data/lib/active_support/reloader.rb +130 -0
- data/lib/active_support/rescuable.rb +112 -57
- data/lib/active_support/ruby_features.rb +7 -0
- data/lib/active_support/secure_compare_rotator.rb +51 -0
- data/lib/active_support/security_utils.rb +38 -0
- data/lib/active_support/string_inquirer.rb +11 -4
- data/lib/active_support/subscriber.rb +109 -39
- data/lib/active_support/tagged_logging.rb +54 -17
- data/lib/active_support/test_case.rb +121 -37
- data/lib/active_support/testing/assertions.rb +177 -39
- data/lib/active_support/testing/autorun.rb +5 -3
- data/lib/active_support/testing/constant_lookup.rb +3 -6
- data/lib/active_support/testing/declarative.rb +10 -22
- data/lib/active_support/testing/deprecation.rb +65 -11
- data/lib/active_support/testing/file_fixtures.rb +38 -0
- data/lib/active_support/testing/isolation.rb +56 -87
- data/lib/active_support/testing/method_call_assertions.rb +70 -0
- data/lib/active_support/testing/parallelization/server.rb +82 -0
- data/lib/active_support/testing/parallelization/worker.rb +103 -0
- data/lib/active_support/testing/parallelization.rb +55 -0
- data/lib/active_support/testing/parallelize_executor.rb +76 -0
- data/lib/active_support/testing/setup_and_teardown.rb +30 -10
- data/lib/active_support/testing/stream.rb +41 -0
- data/lib/active_support/testing/tagged_logging.rb +6 -4
- data/lib/active_support/testing/time_helpers.rb +246 -0
- data/lib/active_support/time.rb +13 -13
- data/lib/active_support/time_with_zone.rb +315 -90
- data/lib/active_support/values/time_zone.rb +306 -135
- data/lib/active_support/version.rb +6 -7
- data/lib/active_support/xml_mini/jdom.rb +117 -115
- data/lib/active_support/xml_mini/libxml.rb +22 -21
- data/lib/active_support/xml_mini/libxmlsax.rb +17 -19
- data/lib/active_support/xml_mini/nokogiri.rb +19 -19
- data/lib/active_support/xml_mini/nokogirisax.rb +16 -17
- data/lib/active_support/xml_mini/rexml.rb +25 -17
- data/lib/active_support/xml_mini.rb +67 -56
- data/lib/active_support.rb +58 -3
- metadata +125 -66
- data/lib/active_support/basic_object.rb +0 -11
- data/lib/active_support/buffered_logger.rb +0 -21
- data/lib/active_support/concurrency/latch.rb +0 -27
- data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
- data/lib/active_support/core_ext/array/uniq_by.rb +0 -19
- data/lib/active_support/core_ext/class/delegating_attributes.rb +0 -40
- data/lib/active_support/core_ext/date_time/zones.rb +0 -24
- data/lib/active_support/core_ext/hash/diff.rb +0 -14
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
- data/lib/active_support/core_ext/kernel/debugger.rb +0 -10
- data/lib/active_support/core_ext/logger.rb +0 -67
- data/lib/active_support/core_ext/marshal.rb +0 -21
- data/lib/active_support/core_ext/module/qualified_const.rb +0 -52
- data/lib/active_support/core_ext/module/reachable.rb +0 -8
- data/lib/active_support/core_ext/object/to_json.rb +0 -27
- data/lib/active_support/core_ext/proc.rb +0 -17
- data/lib/active_support/core_ext/range/include_range.rb +0 -23
- data/lib/active_support/core_ext/string/encoding.rb +0 -8
- data/lib/active_support/core_ext/struct.rb +0 -6
- data/lib/active_support/core_ext/thread.rb +0 -79
- data/lib/active_support/core_ext/time/marshal.rb +0 -30
- data/lib/active_support/file_watcher.rb +0 -36
- data/lib/active_support/json/variable.rb +0 -18
- data/lib/active_support/testing/pending.rb +0 -14
- data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,680 +1,428 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.2.4 (April 26, 2022) ##
|
2
2
|
|
3
|
-
* Fix
|
3
|
+
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
* Make Dependencies pass a name to NameError error.
|
8
|
-
|
9
|
-
*arthurnn*, *Yuki Nishijima*
|
10
|
-
|
11
|
-
|
12
|
-
## Rails 4.0.9 (August 18, 2014) ##
|
13
|
-
|
14
|
-
*No changes*
|
15
|
-
|
16
|
-
|
17
|
-
## Rails 4.0.8 (July 2, 2014) ##
|
18
|
-
|
19
|
-
*No changes*
|
20
|
-
|
21
|
-
|
22
|
-
## Rails 4.0.7 (July 2, 2014) ##
|
23
|
-
|
24
|
-
*No changes*
|
25
|
-
|
26
|
-
|
27
|
-
## Rails 4.0.6 (June 26, 2014) ##
|
28
|
-
|
29
|
-
* `Hash#deep_transform_keys` and `Hash#deep_transform_keys!` now transform hashes
|
30
|
-
in nested arrays. This change also applies to `Hash#deep_stringify_keys`,
|
31
|
-
`Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and
|
32
|
-
`Hash#deep_symbolize_keys!`.
|
5
|
+
Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
|
6
|
+
in names of tags and names of attributes, following the specification of XML.
|
33
7
|
|
34
|
-
|
8
|
+
*Álvaro Martín Fraguas*
|
35
9
|
|
36
|
-
|
37
|
-
given. In particular `#update`, `#merge`, `#replace` all accept objects
|
38
|
-
which respond to `#to_hash`, even if those objects are not Hashes directly.
|
10
|
+
## Rails 7.0.2.3 (March 08, 2022) ##
|
39
11
|
|
40
|
-
|
41
|
-
it responds to `#to_hash`) that object is treated as the default value,
|
42
|
-
rather than the initial keys and value. Changing that could break existing
|
43
|
-
code, so it will be updated in 4.2.
|
12
|
+
* No changes.
|
44
13
|
|
45
|
-
*Peter Jaros*
|
46
14
|
|
15
|
+
## Rails 7.0.2.2 (February 11, 2022) ##
|
47
16
|
|
48
|
-
|
17
|
+
* Fix Reloader method signature to work with the new Executor signature
|
49
18
|
|
50
|
-
*No changes*
|
51
19
|
|
20
|
+
## Rails 7.0.2.1 (February 11, 2022) ##
|
52
21
|
|
53
|
-
|
22
|
+
* No changes.
|
54
23
|
|
55
|
-
* Fix parsing bugs in `XmlMini`
|
56
24
|
|
57
|
-
|
58
|
-
integers). Decimal parsing would fail due to a missing requirement.
|
25
|
+
## Rails 7.0.2 (February 08, 2022) ##
|
59
26
|
|
60
|
-
|
27
|
+
* Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
|
61
28
|
|
62
|
-
*
|
29
|
+
*Stephen Sugden*
|
63
30
|
|
64
|
-
|
31
|
+
* Improve `File.atomic_write` error handling.
|
65
32
|
|
66
|
-
*
|
33
|
+
*Daniel Pepper*
|
67
34
|
|
68
|
-
* Use `remove_possible_method` instead of `remove_method` to avoid
|
69
|
-
a `NameError` to be thrown on FreeBSD with the `Date` object.
|
70
35
|
|
71
|
-
|
36
|
+
## Rails 7.0.1 (January 06, 2022) ##
|
72
37
|
|
73
|
-
*
|
74
|
-
`I18n` will make sure that all locales passed to it must be declared in the
|
75
|
-
`available_locales` list.
|
38
|
+
* Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
|
76
39
|
|
77
|
-
|
40
|
+
[The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33),
|
41
|
+
but `Class#subclasses` was kept, breaking the feature detection.
|
78
42
|
|
79
|
-
|
43
|
+
*Jean Boussier*
|
80
44
|
|
81
|
-
This also ensures I18n configuration is properly initialized taking the new
|
82
|
-
option into account, to avoid their deprecations while booting up the app.
|
83
45
|
|
84
|
-
|
46
|
+
## Rails 7.0.0 (December 15, 2021) ##
|
85
47
|
|
86
|
-
* Fix
|
48
|
+
* Fix `ActiveSupport::Duration.build` to support negative values.
|
87
49
|
|
88
|
-
|
50
|
+
The algorithm to collect the `parts` of the `ActiveSupport::Duration`
|
51
|
+
ignored the sign of the `value` and accumulated incorrect part values. This
|
52
|
+
impacted `ActiveSupport::Duration#sum` (which is dependent on `parts`) but
|
53
|
+
not `ActiveSupport::Duration#eql?` (which is dependent on `value`).
|
89
54
|
|
90
|
-
*
|
55
|
+
*Caleb Buxton*, *Braden Staudacher*
|
91
56
|
|
92
|
-
*Antonio Santos*
|
93
57
|
|
58
|
+
## Rails 7.0.0.rc3 (December 14, 2021) ##
|
94
59
|
|
95
|
-
|
60
|
+
* No changes.
|
96
61
|
|
97
|
-
*No changes*
|
98
62
|
|
63
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
99
64
|
|
100
|
-
|
65
|
+
* No changes.
|
101
66
|
|
102
|
-
|
67
|
+
## Rails 7.0.0.rc1 (December 06, 2021) ##
|
103
68
|
|
69
|
+
* Deprecate passing a format to `#to_s` in favor of `#to_formatted_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
|
70
|
+
`BigDecimal`, `Float` and, `Integer`.
|
104
71
|
|
105
|
-
|
106
|
-
|
107
|
-
* Disable the ability to iterate over Range of AS::TimeWithZone
|
108
|
-
due to significant performance issues.
|
109
|
-
|
110
|
-
*Bogdan Gusiev*
|
111
|
-
|
112
|
-
* Fix `ActiveSupport::Cache::FileStore#cleanup` to no longer rely on missing `each_key` method.
|
113
|
-
|
114
|
-
*Murray Steele*
|
115
|
-
|
116
|
-
* Ensure that autoloaded constants in all-caps nestings are marked as
|
117
|
-
autoloaded.
|
72
|
+
*Rafael Mendonça França*
|
118
73
|
|
119
|
-
|
74
|
+
* Document `ActiveSupport::Testing::Deprecation`.
|
120
75
|
|
121
|
-
*
|
122
|
-
line into `config/environments/development.rb`:
|
76
|
+
*Sam Bostock & Sam Jordan*
|
123
77
|
|
124
|
-
|
78
|
+
* Add `Pathname#existence`.
|
125
79
|
|
126
|
-
|
127
|
-
|
80
|
+
```ruby
|
81
|
+
Pathname.new("file").existence&.read
|
82
|
+
```
|
128
83
|
|
129
|
-
|
84
|
+
*Timo Schilling*
|
130
85
|
|
131
|
-
|
86
|
+
* Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
132
87
|
|
133
|
-
*
|
134
|
-
The memory used by a key/entry pair is calculated via `#cached_size`:
|
88
|
+
*Rafael Mendonça França*
|
135
89
|
|
136
|
-
|
137
|
-
|
138
|
-
end
|
90
|
+
* Remove deprecated support to use `Range#include?` to check the inclusion of a value in
|
91
|
+
a date time range is deprecated.
|
139
92
|
|
140
|
-
|
141
|
-
estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
|
142
|
-
1.9.3 and 2.0.
|
93
|
+
*Rafael Mendonça França*
|
143
94
|
|
144
|
-
|
95
|
+
* Remove deprecated `URI.parser`.
|
145
96
|
|
146
|
-
*
|
97
|
+
*Rafael Mendonça França*
|
147
98
|
|
148
|
-
*
|
99
|
+
* Remove deprecated `config.active_support.use_sha1_digests`.
|
149
100
|
|
150
|
-
|
101
|
+
*Rafael Mendonça França*
|
151
102
|
|
152
|
-
*
|
153
|
-
|
103
|
+
* Invoking `Object#with_options` without a `&block` argument returns the
|
104
|
+
`ActiveSupport::OptionMerger` instance.
|
154
105
|
|
155
|
-
|
106
|
+
*Sean Doyle*
|
156
107
|
|
157
|
-
|
108
|
+
* `Rails.application.executor` hooks can now be called around every test
|
158
109
|
|
159
|
-
|
110
|
+
This helps to better simulate request or job local state being reset around tests and prevents state
|
111
|
+
leaking from one test to another.
|
160
112
|
|
161
|
-
|
113
|
+
However it requires the executor hooks executed in the test environment to be re-entrant.
|
162
114
|
|
163
|
-
|
115
|
+
To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
|
164
116
|
|
165
|
-
*
|
166
|
-
with multiple silencers.
|
117
|
+
*Jean Boussier*
|
167
118
|
|
168
|
-
|
119
|
+
* `ActiveSupport::DescendantsTracker` now mostly delegate to `Class#descendants` on Ruby 3.1
|
169
120
|
|
170
|
-
|
121
|
+
Ruby now provides a fast `Class#descendants` making `ActiveSupport::DescendantsTracker` mostly useless.
|
171
122
|
|
172
|
-
|
173
|
-
`#blame_file!` on Exceptions that do not have the Blamable mixin
|
123
|
+
As a result the following methods are deprecated:
|
174
124
|
|
175
|
-
|
125
|
+
- `ActiveSupport::DescendantsTracker.direct_descendants`
|
126
|
+
- `ActiveSupport::DescendantsTracker#direct_descendants`
|
176
127
|
|
128
|
+
*Jean Boussier*
|
177
129
|
|
178
|
-
|
130
|
+
* Fix the `Digest::UUID.uuid_from_hash` behavior for namespace IDs that are different from the ones defined on `Digest::UUID`.
|
179
131
|
|
180
|
-
|
132
|
+
The new behavior will be enabled by setting the
|
133
|
+
`config.active_support.use_rfc4122_namespaced_uuids` option to `true`
|
134
|
+
and is the default for new apps.
|
181
135
|
|
182
|
-
|
136
|
+
The old behavior is the default for upgraded apps and will output a
|
137
|
+
deprecation warning every time a value that is different than one of
|
138
|
+
the constants defined on the `Digest::UUID` extension is used as the
|
139
|
+
namespace ID.
|
183
140
|
|
184
|
-
*
|
141
|
+
*Alex Robbin*, *Erich Soares Machado*, *Eugene Kenny*
|
185
142
|
|
186
|
-
|
143
|
+
* `ActiveSupport::Inflector::Inflections#clear(:acronyms)` is now supported,
|
144
|
+
and `inflector.clear` / `inflector.clear(:all)` also clears acronyms.
|
187
145
|
|
188
|
-
*
|
146
|
+
*Alex Ghiculescu*, *Oliver Peate*
|
189
147
|
|
190
|
-
*Brian Morearty + Carlos Antonio da Silva*
|
191
148
|
|
192
|
-
|
193
|
-
`ActiveSupport::LogSubscriber`, allowing you to use the event attachment
|
194
|
-
API for other kinds of subscribers.
|
149
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
195
150
|
|
196
|
-
|
151
|
+
* No changes.
|
197
152
|
|
198
|
-
* `Class#class_attribute` accepts an `instance_predicate` option which
|
199
|
-
defaults to `true`. If set to `false` the predicate method will not
|
200
|
-
be defined.
|
201
153
|
|
202
|
-
|
154
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
203
155
|
|
204
|
-
* `
|
156
|
+
* `ActiveSupport::Dependencies` no longer installs a `const_missing` hook. Before this, you could push to the autoload paths and have constants autoloaded. This feature, known as the `classic` autoloader, has been removed.
|
205
157
|
|
206
|
-
*
|
207
|
-
yield its payload.
|
158
|
+
*Xavier Noria*
|
208
159
|
|
209
|
-
|
160
|
+
* Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
|
210
161
|
|
211
|
-
*
|
212
|
-
Fixes #9772.
|
162
|
+
*Xavier Noria*
|
213
163
|
|
214
|
-
|
164
|
+
* The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
|
215
165
|
|
216
|
-
*
|
166
|
+
*Xavier Noria*
|
217
167
|
|
218
|
-
|
168
|
+
* Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
|
219
169
|
|
220
|
-
*
|
221
|
-
Fixes #2608 #1825 #2395.
|
170
|
+
*Mike Dalessio*
|
222
171
|
|
223
|
-
|
172
|
+
* Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
|
224
173
|
|
225
|
-
|
226
|
-
|
174
|
+
Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
|
175
|
+
the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
|
176
|
+
to allow these to be thrown.
|
227
177
|
|
228
|
-
|
229
|
-
'address'.singularize # => 'address'
|
178
|
+
*Nicholas A. Stuart*
|
230
179
|
|
231
|
-
|
180
|
+
* Allow entirely opting out of deprecation warnings.
|
232
181
|
|
233
|
-
|
234
|
-
|
182
|
+
Previously if you did `app.config.active_support.deprecation = :silence`, some work would
|
183
|
+
still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
|
184
|
+
cause performance issues.
|
235
185
|
|
236
|
-
|
186
|
+
Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
|
237
187
|
|
238
|
-
|
188
|
+
```ruby
|
189
|
+
config.active_support.report_deprecations = false
|
190
|
+
```
|
239
191
|
|
240
|
-
|
192
|
+
This is the default in production for new apps. It is the equivalent to:
|
241
193
|
|
242
|
-
|
243
|
-
|
244
|
-
|
194
|
+
```ruby
|
195
|
+
config.active_support.deprecation = :silence
|
196
|
+
config.active_support.disallowed_deprecation = :silence
|
197
|
+
```
|
245
198
|
|
246
|
-
|
199
|
+
but will take a more optimised code path.
|
247
200
|
|
248
|
-
|
249
|
-
time = Time.zone.now
|
250
|
-
time == Time.at(time) # => true
|
201
|
+
*Alex Ghiculescu*
|
251
202
|
|
252
|
-
|
203
|
+
* Faster tests by parallelizing only when overhead is justified by the number
|
204
|
+
of them.
|
253
205
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
Fixes #9269.
|
206
|
+
Running tests in parallel adds overhead in terms of database
|
207
|
+
setup and fixture loading. Now, Rails will only parallelize test executions when
|
208
|
+
there are enough tests to make it worth it.
|
258
209
|
|
259
|
-
|
210
|
+
This threshold is 50 by default, and is configurable via config setting in
|
211
|
+
your test.rb:
|
260
212
|
|
261
|
-
|
262
|
-
|
213
|
+
```ruby
|
214
|
+
config.active_support.test_parallelization_threshold = 100
|
215
|
+
```
|
263
216
|
|
264
|
-
|
217
|
+
It's also configurable at the test case level:
|
265
218
|
|
266
|
-
|
219
|
+
```ruby
|
220
|
+
class ActiveSupport::TestCase
|
221
|
+
parallelize threshold: 100
|
222
|
+
end
|
223
|
+
```
|
267
224
|
|
268
|
-
*
|
225
|
+
*Jorge Manrubia*
|
269
226
|
|
270
|
-
*
|
227
|
+
* OpenSSL constants are now used for Digest computations.
|
271
228
|
|
272
|
-
*
|
229
|
+
*Dirkjan Bussink*
|
273
230
|
|
274
|
-
* `
|
275
|
-
|
231
|
+
* `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
|
232
|
+
A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
|
233
|
+
and `:yday` fragments returned from `Date._iso8601`.
|
276
234
|
|
277
|
-
|
235
|
+
```ruby
|
236
|
+
twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
|
237
|
+
twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
|
238
|
+
```
|
278
239
|
|
279
|
-
*
|
280
|
-
by default, which is optional as per the ISO8601 spec, but extremely useful. Also
|
281
|
-
the default behaviour of `Date#toJSON()` in recent versions of Chrome, Safari and
|
282
|
-
Firefox.
|
240
|
+
*Steve Laing*
|
283
241
|
|
284
|
-
|
242
|
+
* `Time#change` and methods that call it (e.g. `Time#advance`) will now
|
243
|
+
return a `Time` with the timezone argument provided, if the caller was
|
244
|
+
initialized with a timezone argument.
|
285
245
|
|
286
|
-
|
246
|
+
Fixes [#42467](https://github.com/rails/rails/issues/42467).
|
287
247
|
|
288
|
-
*
|
289
|
-
across `String`, `Time`, `Date`, `DateTime` and `ActiveSupport::TimeWithZone`.
|
248
|
+
*Alex Ghiculescu*
|
290
249
|
|
291
|
-
|
250
|
+
* Allow serializing any module or class to JSON by name.
|
292
251
|
|
293
|
-
*
|
294
|
-
You can add the gem to your `Gemfile` to keep using performance tests.
|
252
|
+
*Tyler Rick*, *Zachary Scott*
|
295
253
|
|
296
|
-
|
254
|
+
* Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
|
255
|
+
`RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
|
297
256
|
|
298
|
-
*
|
257
|
+
*Sunny Ripert*
|
299
258
|
|
300
|
-
* `
|
301
|
-
Use `Hash.from_trusted_xml` to parse this XML.
|
259
|
+
* The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
|
302
260
|
|
303
|
-
|
261
|
+
It permits asserting on the initial value that is expected not to change.
|
304
262
|
|
305
|
-
|
263
|
+
```ruby
|
264
|
+
assert_no_changes -> { Status.all_good? }, from: true do
|
265
|
+
post :create, params: { status: { ok: true } }
|
266
|
+
end
|
267
|
+
```
|
306
268
|
|
307
|
-
*
|
308
|
-
`assert object.blank?` and `assert object.present?`
|
269
|
+
*George Claghorn*
|
309
270
|
|
310
|
-
|
271
|
+
* Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
|
311
272
|
|
312
|
-
|
313
|
-
|
273
|
+
Except for a few methods like `String#%`, objects must implement `#to_str`
|
274
|
+
to be implicitly converted to a String in string operations. In some
|
275
|
+
circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
|
276
|
+
explicit conversion method (`#to_s`) on them. This behavior is now
|
277
|
+
deprecated.
|
314
278
|
|
315
|
-
|
316
|
-
"3rd Feb".to_date => Sun, 03 Feb 2013
|
279
|
+
*Jean Boussier*
|
317
280
|
|
318
|
-
|
281
|
+
* Allow nested access to keys on `Rails.application.credentials`.
|
319
282
|
|
320
|
-
|
283
|
+
Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
|
321
284
|
|
322
|
-
|
285
|
+
For example, given these secrets:
|
323
286
|
|
324
|
-
|
287
|
+
```yml
|
288
|
+
aws:
|
289
|
+
access_key_id: 123
|
290
|
+
secret_access_key: 345
|
291
|
+
```
|
325
292
|
|
326
|
-
|
293
|
+
`Rails.application.credentials.aws.access_key_id` will now return the same thing as
|
294
|
+
`Rails.application.credentials.aws[:access_key_id]`.
|
327
295
|
|
328
|
-
|
296
|
+
*Alex Ghiculescu*
|
329
297
|
|
330
|
-
|
331
|
-
twice.
|
298
|
+
* Added a faster and more compact `ActiveSupport::Cache` serialization format.
|
332
299
|
|
333
|
-
|
300
|
+
It can be enabled with `config.active_support.cache_format_version = 7.0` or
|
301
|
+
`config.load_defaults 7.0`. Regardless of the configuration Active Support
|
302
|
+
7.0 can read cache entries serialized by Active Support 6.1 which allows to
|
303
|
+
upgrade without invalidating the cache. However Rails 6.1 can't read the
|
304
|
+
new format, so all readers must be upgraded before the new format is enabled.
|
334
305
|
|
335
|
-
*
|
306
|
+
*Jean Boussier*
|
336
307
|
|
337
|
-
|
308
|
+
* Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
|
309
|
+
sole item of the enumerable, raising if no items are found, or if more than
|
310
|
+
one is.
|
338
311
|
|
339
|
-
*
|
340
|
-
The encoding scheme was broken for unicode characters outside the basic multilingual plane;
|
341
|
-
since json is assumed to be UTF-8, and we already force the encoding to UTF-8,
|
342
|
-
simply pass through the un-encoded characters.
|
312
|
+
*Asherah Connor*
|
343
313
|
|
344
|
-
|
314
|
+
* Freeze `ActiveSupport::Duration#parts` and remove writer methods.
|
345
315
|
|
346
|
-
|
347
|
-
These methods were added to handle the limited range of Ruby's native `Time`
|
348
|
-
implementation. Those limitations no longer apply so we are deprecating them in 4.0
|
349
|
-
and they will be removed in 4.1.
|
316
|
+
Durations are meant to be value objects and should not be mutated.
|
350
317
|
|
351
318
|
*Andrew White*
|
352
319
|
|
353
|
-
*
|
354
|
-
|
355
|
-
* Add `String#in_time_zone` method to convert a string to an `ActiveSupport::TimeWithZone`. *Andrew White*
|
356
|
-
|
357
|
-
* Deprecate `ActiveSupport::BasicObject` in favor of `ActiveSupport::ProxyObject`.
|
358
|
-
This class is used for proxy classes. It avoids confusion with Ruby's `BasicObject`
|
359
|
-
class.
|
360
|
-
|
361
|
-
*Francesco Rodriguez*
|
362
|
-
|
363
|
-
* Patched `Marshal#load` to work with constant autoloading. Fixes autoloading
|
364
|
-
with cache stores that rely on `Marshal` (`MemCacheStore` and `FileStore`).
|
365
|
-
Fixes #8167.
|
366
|
-
|
367
|
-
*Uriel Katz*
|
368
|
-
|
369
|
-
* Make `Time.zone.parse` to work with JavaScript format date strings. *Andrew White*
|
370
|
-
|
371
|
-
* Add `DateTime#seconds_until_end_of_day` and `Time#seconds_until_end_of_day`
|
372
|
-
as a complement for `seconds_from_midnight`; useful when setting expiration
|
373
|
-
times for caches, e.g.:
|
374
|
-
|
375
|
-
<% cache('dashboard', expires_in: Date.current.seconds_until_end_of_day) do %>
|
376
|
-
...
|
377
|
-
|
378
|
-
*Olek Janiszewski*
|
379
|
-
|
380
|
-
* No longer proxy `ActiveSupport::Multibyte#class`. *Steve Klabnik*
|
381
|
-
|
382
|
-
* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from minitest instead. *Carlos Antonio da Silva*
|
383
|
-
|
384
|
-
* `XmlMini.with_backend` now may be safely used with threads:
|
385
|
-
|
386
|
-
Thread.new do
|
387
|
-
XmlMini.with_backend("REXML") { rexml_power }
|
388
|
-
end
|
389
|
-
Thread.new do
|
390
|
-
XmlMini.with_backend("LibXML") { libxml_power }
|
391
|
-
end
|
392
|
-
|
393
|
-
Each thread will use it's own backend.
|
394
|
-
|
395
|
-
*Nikita Afanasenko*
|
396
|
-
|
397
|
-
* Dependencies no longer trigger `Kernel#autoload` in `remove_constant`. Fixes #8213. *Xavier Noria*
|
398
|
-
|
399
|
-
* Simplify `mocha` integration and remove monkey-patches, bumping `mocha` to 0.13.0. *James Mead*
|
400
|
-
|
401
|
-
* `#as_json` isolates options when encoding a hash. Fixes #8182.
|
402
|
-
|
403
|
-
*Yves Senn*
|
404
|
-
|
405
|
-
* Deprecate `Hash#diff` in favor of minitest's #diff. *Steve Klabnik*
|
406
|
-
|
407
|
-
* `Kernel#capture` can catch output from subprocesses. *Dmitry Vorotilin*
|
408
|
-
|
409
|
-
* `to_xml` conversions now use builder's `tag!` method instead of explicit invocation of `method_missing`.
|
410
|
-
|
411
|
-
*Nikita Afanasenko*
|
412
|
-
|
413
|
-
* Fixed timezone mapping of the Solomon Islands. *Steve Klabnik*
|
414
|
-
|
415
|
-
* Make callstack attribute optional in `ActiveSupport::Deprecation::Reporting`
|
416
|
-
methods `warn` and `deprecation_warning`.
|
417
|
-
|
418
|
-
*Alexey Gaziev*
|
320
|
+
* Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
|
419
321
|
|
420
|
-
|
322
|
+
When `utc_to_local_returns_utc_offset_times` is false and the time
|
323
|
+
instance had fractional seconds the new UTC time instance was out by
|
324
|
+
a factor of 1,000,000 as the `Time.utc` constructor takes a usec
|
325
|
+
value and not a fractional second value.
|
421
326
|
|
422
|
-
*
|
423
|
-
and `chmod` calls.
|
424
|
-
|
425
|
-
*Daniele Sluijters*
|
426
|
-
|
427
|
-
* `Hash#extract!` returns only those keys that present in the receiver.
|
428
|
-
|
429
|
-
{a: 1, b: 2}.extract!(:a, :x) # => {:a => 1}
|
430
|
-
|
431
|
-
*Mikhail Dieterle*
|
432
|
-
|
433
|
-
* `Hash#extract!` returns the same subclass, that the receiver is. I.e.
|
434
|
-
`HashWithIndifferentAccess#extract!` returns a `HashWithIndifferentAccess` instance.
|
435
|
-
|
436
|
-
*Mikhail Dieterle*
|
437
|
-
|
438
|
-
* Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead. *Brian Durand*
|
439
|
-
|
440
|
-
* Tests tag the Rails log with the current test class and test case:
|
441
|
-
|
442
|
-
[SessionsControllerTest] [test_0002_sign in] Processing by SessionsController#create as HTML
|
443
|
-
[SessionsControllerTest] [test_0002_sign in] ...
|
444
|
-
|
445
|
-
*Jeremy Kemper*
|
446
|
-
|
447
|
-
* Add `logger.push_tags` and `.pop_tags` to complement `logger.tagged`:
|
448
|
-
|
449
|
-
class Job
|
450
|
-
def before
|
451
|
-
Rails.logger.push_tags :jobs, self.class.name
|
452
|
-
end
|
453
|
-
|
454
|
-
def after
|
455
|
-
Rails.logger.pop_tags 2
|
456
|
-
end
|
457
|
-
end
|
458
|
-
|
459
|
-
*Jeremy Kemper*
|
460
|
-
|
461
|
-
* Allow delegation to the class using the `:class` keyword, replacing
|
462
|
-
`self.class` usage:
|
463
|
-
|
464
|
-
class User
|
465
|
-
def self.hello
|
466
|
-
"world"
|
467
|
-
end
|
468
|
-
|
469
|
-
delegate :hello, to: :class
|
470
|
-
end
|
471
|
-
|
472
|
-
*Marc-Andre Lafortune*
|
473
|
-
|
474
|
-
* `Date.beginning_of_week` thread local and `beginning_of_week` application
|
475
|
-
config option added (default is Monday).
|
476
|
-
|
477
|
-
*Innokenty Mikhailov*
|
478
|
-
|
479
|
-
* An optional block can be passed to `config_accessor` to set its default value
|
480
|
-
|
481
|
-
class User
|
482
|
-
include ActiveSupport::Configurable
|
483
|
-
|
484
|
-
config_accessor :hair_colors do
|
485
|
-
[:brown, :black, :blonde, :red]
|
486
|
-
end
|
487
|
-
end
|
488
|
-
|
489
|
-
User.hair_colors # => [:brown, :black, :blonde, :red]
|
490
|
-
|
491
|
-
*Larry Lv*
|
492
|
-
|
493
|
-
* `ActiveSupport::Benchmarkable#silence` has been deprecated due to its lack of
|
494
|
-
thread safety. It will be removed without replacement in Rails 4.1.
|
495
|
-
|
496
|
-
*Steve Klabnik*
|
497
|
-
|
498
|
-
* An optional block can be passed to `Hash#deep_merge`. The block will be invoked
|
499
|
-
for each duplicated key and used to resolve the conflict.
|
500
|
-
|
501
|
-
*Pranas Kiziela*
|
502
|
-
|
503
|
-
* `ActiveSupport::Deprecation` is now a class. It is possible to create an instance
|
504
|
-
of deprecator. Backwards compatibility has been preserved.
|
505
|
-
|
506
|
-
You can choose which instance of the deprecator will be used.
|
507
|
-
|
508
|
-
deprecate :method_name, deprecator: deprecator_instance
|
327
|
+
*Andrew White*
|
509
328
|
|
510
|
-
|
329
|
+
* Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
|
511
330
|
|
512
|
-
|
513
|
-
|
331
|
+
```ruby
|
332
|
+
Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
|
333
|
+
```
|
514
334
|
|
515
|
-
|
516
|
-
def self.deprecator
|
517
|
-
ActiveSupport::Deprecation.new('2.0', 'MyGem')
|
518
|
-
end
|
335
|
+
*Jean Boussier*
|
519
336
|
|
520
|
-
|
521
|
-
end
|
337
|
+
* Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
|
522
338
|
|
523
|
-
|
524
|
-
end
|
339
|
+
*Andrew White*
|
525
340
|
|
526
|
-
|
527
|
-
|
341
|
+
* Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
|
342
|
+
is considerably faster.
|
528
343
|
|
529
|
-
|
530
|
-
# => DEPRECATION WARNING: old_method is deprecated and will be removed from MyGem 2.0 (use new_method instead). (called from <main> at file.rb:18)
|
344
|
+
Ruby requires an initializer for non-numeric type as per examples below:
|
531
345
|
|
532
|
-
|
346
|
+
```ruby
|
347
|
+
%w[foo bar].sum('')
|
348
|
+
# instead of %w[foo bar].sum
|
533
349
|
|
534
|
-
|
350
|
+
[[1, 2], [3, 4, 5]].sum([])
|
351
|
+
# instead of [[1, 2], [3, 4, 5]].sum
|
352
|
+
```
|
535
353
|
|
536
|
-
*
|
537
|
-
Using the `filter` method like this:
|
354
|
+
*Alberto Mota*
|
538
355
|
|
539
|
-
|
356
|
+
* Tests parallelization is now disabled when running individual files to prevent the setup overhead.
|
540
357
|
|
541
|
-
|
542
|
-
def filter(controller)
|
543
|
-
end
|
544
|
-
end
|
358
|
+
It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
|
545
359
|
|
546
|
-
|
547
|
-
(`#before`, `#after` or `#around`):
|
360
|
+
*Ricardo Díaz*
|
548
361
|
|
549
|
-
|
362
|
+
* Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
|
550
363
|
|
551
|
-
|
552
|
-
def before(controller)
|
553
|
-
end
|
554
|
-
end
|
364
|
+
*Marcin Kołodziej*
|
555
365
|
|
556
|
-
|
366
|
+
* Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
|
367
|
+
elements of an enumerable.
|
557
368
|
|
558
|
-
|
559
|
-
|
560
|
-
thus replicating the behaviour of the corresponding methods on the `Hash` class.
|
369
|
+
```ruby
|
370
|
+
payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
|
561
371
|
|
562
|
-
|
372
|
+
payments.minimum(:price) # => 5
|
373
|
+
payments.maximum(:price) # => 15
|
374
|
+
```
|
563
375
|
|
564
|
-
|
565
|
-
|
566
|
-
and both modules are included in the view context that would confuse the developers.
|
376
|
+
This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
|
377
|
+
See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
|
567
378
|
|
568
|
-
*
|
379
|
+
*Ayrton De Craene*
|
569
380
|
|
570
|
-
*
|
381
|
+
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
571
382
|
|
572
|
-
|
383
|
+
```ruby
|
384
|
+
config.cache_store = :mem_cache_store, nil
|
573
385
|
|
574
|
-
|
575
|
-
errors with empty locales or missing values.
|
386
|
+
# is now equivalent to
|
576
387
|
|
577
|
-
|
388
|
+
config.cache_store = :mem_cache_store
|
578
389
|
|
579
|
-
|
580
|
-
`#encode_json` methods for custom JSON string literals.
|
390
|
+
# and is also equivalent to
|
581
391
|
|
582
|
-
|
392
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
583
393
|
|
584
|
-
|
394
|
+
# which is the fallback behavior of Dalli
|
395
|
+
```
|
585
396
|
|
586
|
-
|
587
|
-
accept locale as an extra argument.
|
397
|
+
This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
|
588
398
|
|
589
|
-
*
|
399
|
+
*Michael Overmeyer*
|
590
400
|
|
591
|
-
* `
|
592
|
-
receiving object does not implement the method, but you can still get the
|
593
|
-
old behavior by using the new `Object#try!`.
|
401
|
+
* Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
|
594
402
|
|
595
403
|
*DHH*
|
596
404
|
|
597
|
-
* `
|
598
|
-
|
599
|
-
* `Time#change` now works with time values with offsets other than UTC or the local time zone. *Andrew White*
|
600
|
-
|
601
|
-
* `ActiveSupport::Callbacks`: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev*
|
602
|
-
|
603
|
-
* Add `Time#prev_quarter` and `Time#next_quarter` short-hands for `months_ago(3)` and `months_since(3)`. *SungHee Kang*
|
604
|
-
|
605
|
-
* Remove obsolete and unused `require_association` method from dependencies. *fxn*
|
606
|
-
|
607
|
-
* Add `:instance_accessor` option for `config_accessor`.
|
608
|
-
|
609
|
-
class User
|
610
|
-
include ActiveSupport::Configurable
|
611
|
-
config_accessor :allowed_access, instance_accessor: false
|
612
|
-
end
|
613
|
-
|
614
|
-
User.new.allowed_access = true # => NoMethodError
|
615
|
-
User.new.allowed_access # => NoMethodError
|
616
|
-
|
617
|
-
*Francesco Rodriguez*
|
618
|
-
|
619
|
-
* `ActionView::Helpers::NumberHelper` methods have been moved to `ActiveSupport::NumberHelper` and are now available via
|
620
|
-
`Numeric#to_s`. `Numeric#to_s` now accepts the formatting options `:phone`, `:currency`, `:percentage`, `:delimited`,
|
621
|
-
`:rounded`, `:human`, and `:human_size`.
|
622
|
-
|
623
|
-
*Andrew Mutz*
|
624
|
-
|
625
|
-
* Add `Hash#transform_keys`, `Hash#transform_keys!`, `Hash#deep_transform_keys`, and `Hash#deep_transform_keys!`. *Mark McSpadden*
|
626
|
-
|
627
|
-
* Changed XML type `datetime` to `dateTime` (with upper case letter `T`). *Angelo Capilleri*
|
628
|
-
|
629
|
-
* Add `:instance_accessor` option for `class_attribute`. *Alexey Vakhov*
|
630
|
-
|
631
|
-
* `constantize` now looks in the ancestor chain. *Marc-Andre Lafortune & Andrew White*
|
632
|
-
|
633
|
-
* Adds `Hash#deep_stringify_keys` and `Hash#deep_stringify_keys!` to convert all keys from a `Hash` instance into strings. *Lucas Húngaro*
|
634
|
-
|
635
|
-
* Adds `Hash#deep_symbolize_keys` and `Hash#deep_symbolize_keys!` to convert all keys from a `Hash` instance into symbols. *Lucas Húngaro*
|
636
|
-
|
637
|
-
* `Object#try` can't call private methods. *Vasiliy Ermolovich*
|
638
|
-
|
639
|
-
* `AS::Callbacks#run_callbacks` remove `key` argument. *Francesco Rodriguez*
|
640
|
-
|
641
|
-
* `deep_dup` works more expectedly now and duplicates also values in `Hash` instances and elements in `Array` instances. *Alexey Gaziev*
|
642
|
-
|
643
|
-
* Inflector no longer applies ice -> ouse to words like "slice", "police", etc. *Wes Morgan*
|
644
|
-
|
645
|
-
* Add `ActiveSupport::Deprecations.behavior = :silence` to completely ignore Rails runtime deprecations. *twinturbo*
|
646
|
-
|
647
|
-
* Make `Module#delegate` stop using `send` - can no longer delegate to private methods. *dasch*
|
648
|
-
|
649
|
-
* `ActiveSupport::Callbacks`: deprecate `:rescuable` option. *Bogdan Gusiev*
|
650
|
-
|
651
|
-
* Adds `Integer#ordinal` to get the ordinal suffix string of an integer. *Tim Gildea*
|
652
|
-
|
653
|
-
* `ActiveSupport::Callbacks`: `:per_key` option is no longer supported. *Bogdan Gusiev*
|
405
|
+
* `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
|
406
|
+
`String#camelize` behavior.
|
654
407
|
|
655
|
-
*
|
408
|
+
*Alex Ghiculescu*
|
656
409
|
|
657
|
-
*
|
410
|
+
* Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
|
411
|
+
invalid.
|
658
412
|
|
659
|
-
*
|
660
|
-
use `Module#local_constants` instead (which returns symbols). *Xavier Noria*
|
413
|
+
*Vipul A M*
|
661
414
|
|
662
|
-
*
|
663
|
-
use `Module#methods` from now on (which returns symbols). *Xavier Noria*
|
415
|
+
* `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
|
664
416
|
|
665
|
-
*
|
666
|
-
use `Module#instance_methods` from now on (which returns symbols). *Xavier Noria*
|
417
|
+
*Nathaniel Woodthorpe*
|
667
418
|
|
668
|
-
* `
|
669
|
-
from the Ruby standard library.
|
419
|
+
* Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
|
670
420
|
|
671
|
-
*
|
421
|
+
*Ritikesh G*
|
672
422
|
|
673
|
-
*
|
423
|
+
* Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
|
674
424
|
|
675
|
-
*
|
676
|
-
of wrapping them in strings for safety.
|
425
|
+
*Ritikesh G*
|
677
426
|
|
678
|
-
* Optimize log subscribers to check log level before doing any processing. *Brian Durand*
|
679
427
|
|
680
|
-
Please check [
|
428
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.
|