activesupport 4.0.13 → 4.2.11.3

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 (166) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +406 -418
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +7 -2
  5. data/lib/active_support/backtrace_cleaner.rb +8 -8
  6. data/lib/active_support/benchmarkable.rb +0 -10
  7. data/lib/active_support/cache/file_store.rb +32 -22
  8. data/lib/active_support/cache/mem_cache_store.rb +5 -7
  9. data/lib/active_support/cache/memory_store.rb +1 -0
  10. data/lib/active_support/cache/strategy/local_cache.rb +11 -30
  11. data/lib/active_support/cache/strategy/local_cache_middleware.rb +44 -0
  12. data/lib/active_support/cache.rb +75 -41
  13. data/lib/active_support/callbacks.rb +482 -261
  14. data/lib/active_support/concern.rb +23 -7
  15. data/lib/active_support/configurable.rb +1 -1
  16. data/lib/active_support/core_ext/array/access.rb +11 -1
  17. data/lib/active_support/core_ext/array/conversions.rb +2 -17
  18. data/lib/active_support/core_ext/array/grouping.rb +29 -12
  19. data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -2
  20. data/lib/active_support/core_ext/array.rb +0 -1
  21. data/lib/active_support/core_ext/big_decimal/conversions.rb +0 -15
  22. data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +16 -0
  23. data/lib/active_support/core_ext/class/attribute.rb +1 -2
  24. data/lib/active_support/core_ext/class/attribute_accessors.rb +4 -170
  25. data/lib/active_support/core_ext/class/delegating_attributes.rb +13 -8
  26. data/lib/active_support/core_ext/class/subclasses.rb +0 -2
  27. data/lib/active_support/core_ext/class.rb +0 -1
  28. data/lib/active_support/core_ext/date/calculations.rb +10 -0
  29. data/lib/active_support/core_ext/date/conversions.rb +9 -1
  30. data/lib/active_support/core_ext/date/zones.rb +2 -33
  31. data/lib/active_support/core_ext/date_and_time/calculations.rb +41 -11
  32. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  33. data/lib/active_support/core_ext/date_and_time/zones.rb +41 -0
  34. data/lib/active_support/core_ext/date_time/calculations.rb +45 -22
  35. data/lib/active_support/core_ext/date_time/compatibility.rb +16 -0
  36. data/lib/active_support/core_ext/date_time/conversions.rb +4 -2
  37. data/lib/active_support/core_ext/date_time/zones.rb +3 -21
  38. data/lib/active_support/core_ext/date_time.rb +1 -0
  39. data/lib/active_support/core_ext/digest/uuid.rb +51 -0
  40. data/lib/active_support/core_ext/enumerable.rb +17 -1
  41. data/lib/active_support/core_ext/file/atomic.rb +1 -1
  42. data/lib/active_support/core_ext/hash/compact.rb +24 -0
  43. data/lib/active_support/core_ext/hash/conversions.rb +9 -8
  44. data/lib/active_support/core_ext/hash/except.rb +8 -2
  45. data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -0
  46. data/lib/active_support/core_ext/hash/keys.rb +25 -19
  47. data/lib/active_support/core_ext/hash/slice.rb +8 -2
  48. data/lib/active_support/core_ext/hash/transform_values.rb +23 -0
  49. data/lib/active_support/core_ext/hash.rb +2 -1
  50. data/lib/active_support/core_ext/integer/time.rb +0 -15
  51. data/lib/active_support/core_ext/kernel/concern.rb +10 -0
  52. data/lib/active_support/core_ext/kernel/debugger.rb +1 -1
  53. data/lib/active_support/core_ext/kernel/reporting.rb +13 -2
  54. data/lib/active_support/core_ext/kernel.rb +3 -2
  55. data/lib/active_support/core_ext/load_error.rb +4 -1
  56. data/lib/active_support/core_ext/marshal.rb +8 -5
  57. data/lib/active_support/core_ext/module/aliasing.rb +2 -2
  58. data/lib/active_support/core_ext/module/attr_internal.rb +2 -1
  59. data/lib/active_support/core_ext/module/attribute_accessors.rb +160 -14
  60. data/lib/active_support/core_ext/module/concerning.rb +135 -0
  61. data/lib/active_support/core_ext/module/delegation.rb +53 -25
  62. data/lib/active_support/core_ext/module/deprecation.rb +0 -2
  63. data/lib/active_support/core_ext/module/introspection.rb +0 -16
  64. data/lib/active_support/core_ext/module/method_transplanting.rb +13 -0
  65. data/lib/active_support/core_ext/module.rb +1 -0
  66. data/lib/active_support/core_ext/numeric/conversions.rb +11 -3
  67. data/lib/active_support/core_ext/numeric/time.rb +4 -29
  68. data/lib/active_support/core_ext/object/blank.rb +44 -18
  69. data/lib/active_support/core_ext/object/deep_dup.rb +6 -6
  70. data/lib/active_support/core_ext/object/duplicable.rb +72 -33
  71. data/lib/active_support/core_ext/object/inclusion.rb +16 -15
  72. data/lib/active_support/core_ext/object/itself.rb +15 -0
  73. data/lib/active_support/core_ext/object/json.rb +197 -0
  74. data/lib/active_support/core_ext/object/to_query.rb +14 -6
  75. data/lib/active_support/core_ext/object/try.rb +36 -14
  76. data/lib/active_support/core_ext/object/with_options.rb +30 -3
  77. data/lib/active_support/core_ext/object.rb +2 -1
  78. data/lib/active_support/core_ext/string/access.rb +35 -35
  79. data/lib/active_support/core_ext/string/conversions.rb +10 -9
  80. data/lib/active_support/core_ext/string/exclude.rb +3 -3
  81. data/lib/active_support/core_ext/string/filters.rb +51 -3
  82. data/lib/active_support/core_ext/string/inflections.rb +15 -10
  83. data/lib/active_support/core_ext/string/output_safety.rb +97 -33
  84. data/lib/active_support/core_ext/string/zones.rb +1 -0
  85. data/lib/active_support/core_ext/thread.rb +12 -5
  86. data/lib/active_support/core_ext/time/calculations.rb +47 -68
  87. data/lib/active_support/core_ext/time/compatibility.rb +14 -0
  88. data/lib/active_support/core_ext/time/conversions.rb +4 -2
  89. data/lib/active_support/core_ext/time/zones.rb +2 -20
  90. data/lib/active_support/core_ext/time.rb +1 -0
  91. data/lib/active_support/core_ext.rb +0 -1
  92. data/lib/active_support/dependencies/autoload.rb +1 -1
  93. data/lib/active_support/dependencies.rb +64 -25
  94. data/lib/active_support/deprecation/behaviors.rb +4 -4
  95. data/lib/active_support/deprecation.rb +4 -4
  96. data/lib/active_support/duration.rb +55 -11
  97. data/lib/active_support/file_update_checker.rb +1 -1
  98. data/lib/active_support/gem_version.rb +15 -0
  99. data/lib/active_support/hash_with_indifferent_access.rb +39 -11
  100. data/lib/active_support/i18n.rb +4 -4
  101. data/lib/active_support/i18n_railtie.rb +1 -7
  102. data/lib/active_support/inflections.rb +6 -1
  103. data/lib/active_support/inflector/inflections.rb +19 -19
  104. data/lib/active_support/inflector/methods.rb +66 -25
  105. data/lib/active_support/json/decoding.rb +15 -22
  106. data/lib/active_support/json/encoding.rb +125 -286
  107. data/lib/active_support/key_generator.rb +8 -10
  108. data/lib/active_support/lazy_load_hooks.rb +1 -1
  109. data/lib/active_support/log_subscriber/test_helper.rb +1 -1
  110. data/lib/active_support/logger.rb +51 -1
  111. data/lib/active_support/logger_silence.rb +7 -4
  112. data/lib/active_support/logger_thread_safe_level.rb +32 -0
  113. data/lib/active_support/message_encryptor.rb +14 -6
  114. data/lib/active_support/message_verifier.rb +16 -12
  115. data/lib/active_support/multibyte/chars.rb +2 -3
  116. data/lib/active_support/multibyte/unicode.rb +46 -58
  117. data/lib/active_support/notifications/fanout.rb +12 -7
  118. data/lib/active_support/notifications/instrumenter.rb +2 -1
  119. data/lib/active_support/notifications.rb +11 -6
  120. data/lib/active_support/number_helper/number_converter.rb +182 -0
  121. data/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
  122. data/lib/active_support/number_helper/number_to_delimited_converter.rb +23 -0
  123. data/lib/active_support/number_helper/number_to_human_converter.rb +66 -0
  124. data/lib/active_support/number_helper/number_to_human_size_converter.rb +58 -0
  125. data/lib/active_support/number_helper/number_to_percentage_converter.rb +12 -0
  126. data/lib/active_support/number_helper/number_to_phone_converter.rb +49 -0
  127. data/lib/active_support/number_helper/number_to_rounded_converter.rb +87 -0
  128. data/lib/active_support/number_helper.rb +32 -324
  129. data/lib/active_support/ordered_options.rb +8 -0
  130. data/lib/active_support/per_thread_registry.rb +13 -10
  131. data/lib/active_support/security_utils.rb +27 -0
  132. data/lib/active_support/subscriber.rb +35 -3
  133. data/lib/active_support/test_case.rb +52 -19
  134. data/lib/active_support/testing/assertions.rb +1 -31
  135. data/lib/active_support/testing/autorun.rb +2 -2
  136. data/lib/active_support/testing/constant_lookup.rb +1 -5
  137. data/lib/active_support/testing/declarative.rb +7 -21
  138. data/lib/active_support/testing/isolation.rb +29 -69
  139. data/lib/active_support/testing/setup_and_teardown.rb +17 -2
  140. data/lib/active_support/testing/tagged_logging.rb +2 -2
  141. data/lib/active_support/testing/time_helpers.rb +134 -0
  142. data/lib/active_support/time.rb +0 -2
  143. data/lib/active_support/time_with_zone.rb +60 -40
  144. data/lib/active_support/values/time_zone.rb +101 -101
  145. data/lib/active_support/values/unicode_tables.dat +0 -0
  146. data/lib/active_support/version.rb +4 -7
  147. data/lib/active_support/xml_mini/jdom.rb +6 -5
  148. data/lib/active_support/xml_mini/libxml.rb +1 -3
  149. data/lib/active_support/xml_mini/libxmlsax.rb +1 -4
  150. data/lib/active_support/xml_mini/nokogiri.rb +1 -3
  151. data/lib/active_support/xml_mini/nokogirisax.rb +1 -3
  152. data/lib/active_support/xml_mini/rexml.rb +7 -8
  153. data/lib/active_support/xml_mini.rb +33 -15
  154. data/lib/active_support.rb +27 -2
  155. metadata +43 -43
  156. data/lib/active_support/basic_object.rb +0 -11
  157. data/lib/active_support/buffered_logger.rb +0 -21
  158. data/lib/active_support/core_ext/array/uniq_by.rb +0 -19
  159. data/lib/active_support/core_ext/hash/diff.rb +0 -14
  160. data/lib/active_support/core_ext/logger.rb +0 -67
  161. data/lib/active_support/core_ext/object/to_json.rb +0 -27
  162. data/lib/active_support/core_ext/proc.rb +0 -17
  163. data/lib/active_support/core_ext/string/encoding.rb +0 -8
  164. data/lib/active_support/file_watcher.rb +0 -36
  165. data/lib/active_support/json/variable.rb +0 -18
  166. data/lib/active_support/testing/pending.rb +0 -14
data/CHANGELOG.md CHANGED
@@ -1,700 +1,688 @@
1
- ## Rails 4.0.13 (January 6, 2015) ##
1
+ ## Rails 4.2.11.3 (May 15, 2020) ##
2
2
 
3
- *No changes*
3
+ * No changes.
4
4
 
5
5
 
6
- ## Rails 4.0.12 (November 16, 2014) ##
6
+ ## Rails 4.2.11.2 (May 15, 2020) ##
7
7
 
8
- *No changes*
8
+ * No changes.
9
9
 
10
10
 
11
- ## Rails 4.0.11.1 (November 19, 2014) ##
11
+ ## Rails 4.2.11.1 (March 11, 2019) ##
12
12
 
13
- *No changes*
13
+ * No changes.
14
14
 
15
15
 
16
- ## Rails 4.0.11 (September 11, 2014) ##
16
+ ## Rails 4.2.11 (November 27, 2018) ##
17
17
 
18
- *No changes*
18
+ * No changes.
19
19
 
20
20
 
21
- ## Rails 4.0.10 (September 11, 2014) ##
21
+ ## Rails 4.2.10 (September 27, 2017) ##
22
22
 
23
- * Fix DateTime comparison with DateTime::Infinity object.
23
+ * No changes.
24
24
 
25
- *Rafael Mendonça França*
26
-
27
- * Make Dependencies pass a name to NameError error.
28
25
 
29
- *arthurnn*, *Yuki Nishijima*
26
+ ## Rails 4.2.9 (June 26, 2017) ##
30
27
 
28
+ * Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
29
+ raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
30
+ Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
31
+ when calling `#to_time`.
31
32
 
32
- ## Rails 4.0.9 (August 18, 2014) ##
33
+ *Kevin McPhillips* & *Andrew White*
33
34
 
34
- *No changes*
35
+ * Restore the return type of `DateTime#utc`
35
36
 
37
+ In Rails 5.0 the return type of `DateTime#utc` was changed to `Time` to be
38
+ consistent with the new `DateTime#localtime` method. When these changes were
39
+ backported in #27553 this inadvertently changed the return type in a patcn
40
+ release. Since `DateTime#localtime` was new in Rails 4.2.8 it's okay to
41
+ restore the return type of `DateTime#utc` but keep `DateTime#localtime` as
42
+ returning `Time` without breaking backwards compatibility.
36
43
 
37
- ## Rails 4.0.8 (July 2, 2014) ##
38
-
39
- *No changes*
40
-
44
+ *Andrew White*
41
45
 
42
- ## Rails 4.0.7 (July 2, 2014) ##
46
+ * In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional
47
+ argument for `Marshal#load( source [, proc] )`. This way we don't have to do
48
+ `Marshal.method(:load).super_method.call(sourse, proc)` just to be able to pass a proc.
43
49
 
44
- *No changes*
50
+ *Jeff Latz*
45
51
 
52
+ * Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
46
53
 
47
- ## Rails 4.0.6 (June 26, 2014) ##
54
+ *Adam Rice*
48
55
 
49
- * `Hash#deep_transform_keys` and `Hash#deep_transform_keys!` now transform hashes
50
- in nested arrays. This change also applies to `Hash#deep_stringify_keys`,
51
- `Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and
52
- `Hash#deep_symbolize_keys!`.
56
+ * `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
57
+ `Time.now` and `Date.today`.
53
58
 
54
- *OZAWA Sakuro*
59
+ *Yuki Nishijima*
55
60
 
56
- * `HashWithIndifferentAccess` better respects `#to_hash` on objects it's
57
- given. In particular `#update`, `#merge`, `#replace` all accept objects
58
- which respond to `#to_hash`, even if those objects are not Hashes directly.
59
61
 
60
- Currently, if `HashWithIndifferentAccess.new` is given a non-Hash (even if
61
- it responds to `#to_hash`) that object is treated as the default value,
62
- rather than the initial keys and value. Changing that could break existing
63
- code, so it will be updated in 4.2.
62
+ ## Rails 4.2.8 (February 21, 2017) ##
64
63
 
65
- *Peter Jaros*
64
+ * Make `getlocal` and `getutc` always return instances of `Time` for
65
+ `ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible
66
+ stack level too deep error in `to_time` where `ActiveSupport::TimeWithZone`
67
+ was wrapping a `DateTime` instance. As a consequence of this the internal
68
+ time value in `ActiveSupport::TimeWithZone` is now always an instance of
69
+ `Time` in the UTC timezone, whether that's as the UTC time directly or
70
+ a representation of the local time in the timezone. There should be no
71
+ consequences of this internal change and if there are it's a bug due to
72
+ leaky abstractions.
66
73
 
74
+ *Andrew White*
67
75
 
68
- ## Rails 4.0.5 (May 6, 2014) ##
69
-
70
- *No changes*
71
-
76
+ * Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
72
77
 
73
- ## Rails 4.0.4 (March 14, 2014) ##
78
+ *Andrew White*
74
79
 
75
- * Fix parsing bugs in `XmlMini`
80
+ * Add additional aliases for `DateTime#utc` to mirror the ones on
81
+ `ActiveSupport::TimeWithZone` and `Time`.
76
82
 
77
- Symbols or boolean parsing would raise an error for non string values (e.g.
78
- integers). Decimal parsing would fail due to a missing requirement.
83
+ *Andrew White*
79
84
 
80
- *Birkir A. Barkarson*
85
+ * Add `DateTime#localtime` to return an instance of `Time` in the system's
86
+ local timezone. Also aliased to `getlocal`.
81
87
 
82
- * Re-enable support for iterating over `DateTime` ranges
88
+ *Andrew White*, *Yuichiro Kaneko*
83
89
 
84
- Fixes #13667.
90
+ * Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.
85
91
 
86
- *Prathamesh Sonpatki*
92
+ *Andrew White*
87
93
 
88
- * Use `remove_possible_method` instead of `remove_method` to avoid
89
- a `NameError` to be thrown on FreeBSD with the `Date` object.
94
+ * Add `ActiveSupport.to_time_preserves_timezone` config option to control
95
+ how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
96
+ from converting to the local system timezone, to preserving the timezone
97
+ of the receiver. This config option defaults to false so that apps made
98
+ with earlier versions of Rails are not affected when upgrading, e.g:
90
99
 
91
- *Rafael Mendonça França*, *Robin Dupret*
100
+ >> ENV['TZ'] = 'US/Eastern'
92
101
 
93
- * Default the new `I18n.enforce_available_locales` config to `true`, meaning
94
- `I18n` will make sure that all locales passed to it must be declared in the
95
- `available_locales` list.
102
+ >> "2016-04-23T10:23:12.000Z".to_time
103
+ => "2016-04-23T06:23:12.000-04:00"
96
104
 
97
- To disable it add the following configuration to your application:
105
+ >> ActiveSupport.to_time_preserves_timezone = true
98
106
 
99
- config.i18n.enforce_available_locales = false
107
+ >> "2016-04-23T10:23:12.000Z".to_time
108
+ => "2016-04-23T10:23:12.000Z"
100
109
 
101
- This also ensures I18n configuration is properly initialized taking the new
102
- option into account, to avoid their deprecations while booting up the app.
110
+ Fixes #24617.
103
111
 
104
- *Carlos Antonio da Silva*, *Yves Senn*
112
+ *Andrew White*
105
113
 
106
- * Fix file descriptor being leaked on each call to `Kernel.silence_stream`.
114
+ * Add `init_with` to `ActiveSupport::TimeWithZone` and `ActiveSupport::TimeZone`
107
115
 
108
- *Mario Visic*
116
+ It is helpful to be able to run apps concurrently written in successive
117
+ versions of Rails to aid migration, e.g. run Rails 4.2 and 5.0 variants
118
+ of your application at the same time to carry out A/B testing.
109
119
 
110
- * Fix `slice!` deleting the default value of the hash.
120
+ To do this serialization formats need to be cross compatible and the
121
+ change in 3aa26cf didn't meet this criteria because the Psych loader
122
+ checks for the existence of `init_with` before setting the instance
123
+ variables and the wrapping behavior of `ActiveSupport::TimeWithZone`
124
+ tries to see if the `Time` instance responds to `init_with` before the
125
+ `@time` variable is set.
111
126
 
112
- *Antonio Santos*
127
+ To fix this we backported just the `init_with` behavior from the change
128
+ in 3aa26cf. If the revived instance is then written out to YAML again
129
+ it will revert to the default Rails 4.2 behavior of converting it to
130
+ a UTC timestamp string.
113
131
 
132
+ Fixes #26296.
114
133
 
115
- ## Rails 4.0.3 (February 18, 2014) ##
134
+ *Andrew White*
116
135
 
117
- *No changes*
136
+ * Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
118
137
 
138
+ Previously calls to `in` were being sent to the non-DST aware
139
+ method `Time#since` via `method_missing`. It is now aliased to
140
+ the DST aware `ActiveSupport::TimeWithZone#since` which handles
141
+ transitions across DST boundaries, e.g:
119
142
 
120
- ## Rails 4.0.2 (December 02, 2013) ##
143
+ Time.zone = "US/Eastern"
121
144
 
122
- *No changes*
145
+ t = Time.zone.local(2016,11,6,1)
146
+ # => Sun, 06 Nov 2016 01:00:00 EDT -05:00
123
147
 
148
+ t.in(1.hour)
149
+ # => Sun, 06 Nov 2016 01:00:00 EST -05:00
124
150
 
125
- ## Rails 4.0.1 (November 01, 2013) ##
151
+ Fixes #26580.
126
152
 
127
- * Disable the ability to iterate over Range of AS::TimeWithZone
128
- due to significant performance issues.
153
+ *Thomas Balthazar*
129
154
 
130
- *Bogdan Gusiev*
131
155
 
132
- * Fix `ActiveSupport::Cache::FileStore#cleanup` to no longer rely on missing `each_key` method.
156
+ ## Rails 4.2.7 (July 12, 2016) ##
133
157
 
134
- *Murray Steele*
158
+ * Fixed `ActiveSupport::Logger.broadcast` so that calls to `#silence` now
159
+ properly delegate to all loggers. Silencing now properly suppresses logging
160
+ to both the log and the console.
135
161
 
136
- * Ensure that autoloaded constants in all-caps nestings are marked as
137
- autoloaded.
162
+ *Kevin McPhillips*
138
163
 
139
- *Simon Coffey*
164
+ * Backported `ActiveSupport::LoggerThreadSafeLevel`. Assigning the
165
+ `Rails.logger.level` is now thread safe.
140
166
 
141
- * Adds a new deprecation behaviour that raises an exception. Throwing this
142
- line into `config/environments/development.rb`:
167
+ *Kevin McPhillips*
143
168
 
144
- ActiveSupport::Deprecation.behavior = :raise
169
+ * Fixed a problem with ActiveSupport::SafeBuffer.titleize calling capitalize
170
+ on nil.
145
171
 
146
- will cause the application to raise an `ActiveSupport::DeprecationException`
147
- on deprecations.
172
+ *Brian McManus*
148
173
 
149
- Use this for aggressive deprecation cleanups.
174
+ * Time zones: Ensure that the UTC offset reflects DST changes that occurred
175
+ since the app started. Removes UTC offset caching, reducing performance,
176
+ but this is still relatively quick and isn't in any hot paths.
150
177
 
151
- *Xavier Noria*
178
+ *Alexey Shein*
152
179
 
153
- * Improve `ActiveSupport::Cache::MemoryStore` cache size calculation.
154
- The memory used by a key/entry pair is calculated via `#cached_size`:
180
+ * Prevent `Marshal.load` from looping infinitely when trying to autoload a constant
181
+ which resolves to a different name.
155
182
 
156
- def cached_size(key, entry)
157
- key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
158
- end
183
+ *Olek Janiszewski*
159
184
 
160
- The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
161
- estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
162
- 1.9.3 and 2.0.
163
185
 
164
- Fixes #11512.
186
+ ## Rails 4.2.6 (March 07, 2016) ##
165
187
 
166
- *Simeon Simeonov*
188
+ * No changes.
167
189
 
168
- * Only raise `Module::DelegationError` if it's the source of the exception.
169
190
 
170
- Fixes #10559.
191
+ ## Rails 4.2.5.2 (February 26, 2016) ##
171
192
 
172
- * Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps
173
- sub-second resolution when wrapping a `DateTime` value.
193
+ * No changes.
174
194
 
175
- Fixes #10855.
176
195
 
177
- *Andrew White*
196
+ ## Rails 4.2.5.1 (January 25, 2015) ##
178
197
 
179
- * Make `Time.at_with_coercion` retain the second fraction and return local time.
198
+ * No changes.
180
199
 
181
- Fixes #11350.
182
200
 
183
- *Neer Friedman*, *Andrew White*
201
+ ## Rails 4.2.5 (November 12, 2015) ##
184
202
 
185
- * Fix return value from `BacktraceCleaner#noise` when the cleaner is configured
186
- with multiple silencers.
203
+ * Fix `TimeWithZone#eql?` to properly handle `TimeWithZone` created from `DateTime`:
204
+ twz = DateTime.now.in_time_zone
205
+ twz.eql?(twz.dup) => true
187
206
 
188
- Fixes #11030.
207
+ Fixes #14178.
189
208
 
190
- *Mark J. Titorenko*
209
+ *Roque Pinel*
191
210
 
192
- * Fix `ActiveSupport::Dependencies::Loadable#load_dependency` calling
193
- `#blame_file!` on Exceptions that do not have the Blamable mixin
211
+ * Handle invalid UTF-8 characters in `MessageVerifier.verify`.
194
212
 
195
- *Andrew Kreiling*
213
+ *Roque Pinel*, *Grey Baker*
196
214
 
197
215
 
198
- ## Rails 4.0.0 (June 25, 2013) ##
216
+ ## Rails 4.2.4 (August 24, 2015) ##
199
217
 
200
- * Override `Time.at` to support the passing of Time-like values when called with a single argument.
218
+ * Fix a `SystemStackError` when encoding an `Enumerable` with `json` gem and
219
+ with the Active Support JSON encoder loaded.
201
220
 
202
- *Andrew White*
221
+ Fixes #20775.
203
222
 
204
- * Allow Date to be compared with Time (like it was possible to compare Time with Date).
223
+ *Sammy Larbi*, *Prathamesh Sonpatki*
205
224
 
206
- *DHH*
225
+ * Fix not calling `#default` on `HashWithIndifferentAcess#to_hash` when only
226
+ `default_proc` is set, which could raise.
207
227
 
208
- * Deprecate multiple parameters support of `Object#in?`.
228
+ *Simon Eskildsen*
209
229
 
210
- *Brian Morearty + Carlos Antonio da Silva*
230
+ * Fix setting `default_proc` on `HashWithIndifferentAccess#dup`
211
231
 
212
- * An `ActiveSupport::Subscriber` class has been extracted from
213
- `ActiveSupport::LogSubscriber`, allowing you to use the event attachment
214
- API for other kinds of subscribers.
232
+ *Simon Eskildsen*
215
233
 
216
- *Daniel Schierbeck*
217
234
 
218
- * `Class#class_attribute` accepts an `instance_predicate` option which
219
- defaults to `true`. If set to `false` the predicate method will not
220
- be defined.
235
+ ## Rails 4.2.3 (June 25, 2015) ##
221
236
 
222
- *Agis Anastasopoulos*
237
+ * Fix a range of values for parameters of the Time#change
223
238
 
224
- * `fast_xs` support has been removed. Use `String#encode(xml: :attr)`.
239
+ *Nikolay Kondratyev*
225
240
 
226
- * `ActiveSupport::Notifications::Instrumenter#instrument` should
227
- yield its payload.
241
+ * Add some missing `require 'active_support/deprecation'`
228
242
 
229
- *stopdropandrew*
230
-
231
- * `ActiveSupport::TimeWithZone` raises `NoMethodError` in proper context.
232
- Fixes #9772.
233
-
234
- *Yves Senn*
235
-
236
- * Fix deletion of empty directories in `ActiveSupport::Cache::FileStore`.
243
+ *Akira Matsuda*
237
244
 
238
- *Charles Jones*
239
245
 
240
- * Improve singularizing a singular for multiple cases.
241
- Fixes #2608 #1825 #2395.
246
+ ## Rails 4.2.2 (June 16, 2015) ##
242
247
 
243
- Example:
248
+ * Fix XSS vulnerability in `ActiveSupport::JSON.encode` method.
244
249
 
245
- # Before
246
- 'address'.singularize # => 'addres'
250
+ CVE-2015-3226.
247
251
 
248
- # After
249
- 'address'.singularize # => 'address'
252
+ *Rafael Mendonça França*
250
253
 
251
- *Mark McSpadden*
254
+ * Fix denial of service vulnerability in the XML processing.
252
255
 
253
- * Prevent `DateTime#change` from truncating the second fraction, when seconds
254
- do not need to be changed.
256
+ CVE-2015-3227.
255
257
 
256
- *Chris Baynes*
258
+ *Aaron Patterson*
257
259
 
258
- * Added `ActiveSupport::TimeWithZone#to_r` for `Time#at` compatibility.
259
260
 
260
- Before this change:
261
+ ## Rails 4.2.1 (March 19, 2015) ##
261
262
 
262
- Time.zone = 'Tokyo'
263
- time = Time.zone.now
264
- time == Time.at(time) # => false
263
+ * Fixed a problem where String#truncate_words would get stuck with a complex
264
+ string.
265
265
 
266
- After the change:
266
+ *Henrik Nygren*
267
267
 
268
- Time.zone = 'Tokyo'
269
- time = Time.zone.now
270
- time == Time.at(time) # => true
268
+ * Fixed a roundtrip problem with AS::SafeBuffer where primitive-like strings
269
+ will be dumped as primitives:
271
270
 
272
- *stopdropandrew*
271
+ Before:
273
272
 
274
- * `ActiveSupport::NumberHelper#number_to_human` returns the number unaltered when
275
- the given units hash does not contain the needed key, e.g. when the number provided
276
- is less than the largest key provided.
277
- Fixes #9269.
273
+ YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
274
+ YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true
275
+ YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false
276
+ YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
277
+ YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
278
278
 
279
- Examples:
279
+ After:
280
280
 
281
- number_to_human(123, units: {}) # => 123
282
- number_to_human(123, units: { thousand: 'k' }) # => 123
281
+ YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
282
+ YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
283
+ YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
284
+ YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
285
+ YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
283
286
 
284
- *Michael Hoffman*
287
+ *Godfrey Chan*
285
288
 
286
- * Added `beginning_of_minute` support to core ext calculations for `Time` and `DateTime`.
289
+ * Replace fixed `:en` with `I18n.default_locale` in `Duration#inspect`.
287
290
 
288
- *Gagan Awhad*
291
+ *Dominik Masur*
289
292
 
290
- * Add `:nsec` date format.
293
+ * Add missing time zone definitions for Russian Federation and sync them
294
+ with `zone.tab` file from tzdata version 2014j (latest).
291
295
 
292
- *Jamie Gaskins*
296
+ *Andrey Novikov*
293
297
 
294
- * `ActiveSupport::Gzip.compress` allows two optional arguments for compression
295
- level and strategy.
296
298
 
297
- *Beyond*
299
+ ## Rails 4.2.0 (December 20, 2014) ##
298
300
 
299
- * Modify `TimeWithZone#as_json` to include 3 decimal places of sub-second accuracy
300
- by default, which is optional as per the ISO8601 spec, but extremely useful. Also
301
- the default behaviour of `Date#toJSON()` in recent versions of Chrome, Safari and
302
- Firefox.
301
+ * The decorated `load` and `require` methods are now kept private.
303
302
 
304
- *James Harton*
303
+ Fixes #17553.
305
304
 
306
- * Improve `String#squish` to handle Unicode whitespace. *Antoine Lyset*
305
+ *Xavier Noria*
307
306
 
308
- * Standardise on `to_time` returning an instance of `Time` in the local system timezone
309
- across `String`, `Time`, `Date`, `DateTime` and `ActiveSupport::TimeWithZone`.
307
+ * `String#remove` and `String#remove!` accept multiple arguments.
310
308
 
311
- *Andrew White*
309
+ *Pavel Pravosud*
312
310
 
313
- * Extract `ActiveSupport::Testing::Performance` into https://github.com/rails/rails-perftest
314
- You can add the gem to your `Gemfile` to keep using performance tests.
311
+ * `TimeWithZone#strftime` now delegates every directive to `Time#strftime` except for '%Z',
312
+ it also now correctly handles escaped '%' characters placed just before time zone related directives.
315
313
 
316
- gem 'rails-perftest'
314
+ *Pablo Herrero*
317
315
 
318
- *Yves Senn*
316
+ * Corrected `Inflector#underscore` handling of multiple successive acroynms.
319
317
 
320
- * `Hash.from_xml` raises when it encounters `type="symbol"` or `type="yaml"`.
321
- Use `Hash.from_trusted_xml` to parse this XML.
318
+ *James Le Cuirot*
322
319
 
323
- CVE-2013-0156
320
+ * Delegation now works with ruby reserved words passed to `:to` option.
324
321
 
325
- *Jeremy Kemper*
322
+ Fixes #16956.
326
323
 
327
- * Deprecate `assert_present` and `assert_blank` in favor of
328
- `assert object.blank?` and `assert object.present?`
324
+ *Agis Anastasopoulos*
329
325
 
330
- *Yves Senn*
326
+ * Added method `#eql?` to `ActiveSupport::Duration`, in addition to `#==`.
331
327
 
332
- * Change `String#to_date` to use `Date.parse`. This gives more consistent error
333
- messages and allows the use of partial dates.
328
+ Currently, the following returns `false`, contrary to expectation:
334
329
 
335
- "gibberish".to_date => Argument Error: invalid date
336
- "3rd Feb".to_date => Sun, 03 Feb 2013
330
+ 1.minute.eql?(1.minute)
337
331
 
338
- *Kelly Stannard*
332
+ Adding method `#eql?` will make this behave like expected. Method `#eql?` is
333
+ just a bit stricter than `#==`, as it checks whether the argument is also a duration. Their
334
+ parts may be different though.
339
335
 
340
- * Remove meaningless `ActiveSupport::FrozenObjectError`, which was just an alias of `RuntimeError`.
336
+ 1.minute.eql?(60.seconds) # => true
337
+ 1.minute.eql?(60) # => false
341
338
 
342
- *Akira Matsuda*
339
+ *Joost Lubach*
343
340
 
344
- * Introduce `assert_not` to replace warty `assert !foo`. *Jeremy Kemper*
341
+ * `Time#change` can now change nanoseconds (`:nsec`) as a higher-precision
342
+ alternative to microseconds (`:usec`).
345
343
 
346
- * Prevent `Callbacks#set_callback` from setting the same callback twice.
344
+ *Agis Anastasooulos*
347
345
 
348
- before_save :foo, :bar, :foo
346
+ * `MessageVerifier.new` raises an appropriate exception if the secret is `nil`.
347
+ This prevents `MessageVerifier#generate` from raising a cryptic error later on.
349
348
 
350
- will at first call `bar`, then `foo`. `foo` will no more be called
351
- twice.
349
+ *Kostiantyn Kahanskyi*
352
350
 
353
- *Dmitriy Kiriyenko*
351
+ * Introduced new configuration option `active_support.test_order` for
352
+ specifying the order in which test cases are executed. This option currently defaults
353
+ to `:sorted` but will be changed to `:random` in Rails 5.0.
354
354
 
355
- * Add `ActiveSupport::Logger#silence` that works the same as the old `Logger#silence` extension.
355
+ *Akira Matsuda*, *Godfrey Chan*
356
356
 
357
- *DHH*
357
+ * Fixed a bug in `Inflector#underscore` where acroynms in nested constant names
358
+ are incorrectly parsed as camelCase.
358
359
 
359
- * Remove surrogate unicode character encoding from `ActiveSupport::JSON.encode`
360
- The encoding scheme was broken for unicode characters outside the basic multilingual plane;
361
- since json is assumed to be UTF-8, and we already force the encoding to UTF-8,
362
- simply pass through the un-encoded characters.
360
+ Fixes #8015.
363
361
 
364
- *Brett Carter*
362
+ *Fred Wu*, *Matthew Draper*
365
363
 
366
- * Deprecate `Time.time_with_date_fallback`, `Time.utc_time` and `Time.local_time`.
367
- These methods were added to handle the limited range of Ruby's native `Time`
368
- implementation. Those limitations no longer apply so we are deprecating them in 4.0
369
- and they will be removed in 4.1.
364
+ * Make `Time#change` throw an exception if the `:usec` option is out of range and
365
+ the time has an offset other than UTC or local.
370
366
 
371
- *Andrew White*
367
+ *Agis Anastasopoulos*
372
368
 
373
- * Deprecate `Date#to_time_in_current_zone` and add `Date#in_time_zone`. *Andrew White*
369
+ * `Method` objects now report themselves as not `duplicable?`. This allows
370
+ hashes and arrays containing `Method` objects to be `deep_dup`ed.
374
371
 
375
- * Add `String#in_time_zone` method to convert a string to an `ActiveSupport::TimeWithZone`. *Andrew White*
372
+ *Peter Jaros*
376
373
 
377
- * Deprecate `ActiveSupport::BasicObject` in favor of `ActiveSupport::ProxyObject`.
378
- This class is used for proxy classes. It avoids confusion with Ruby's `BasicObject`
379
- class.
374
+ * `determine_constant_from_test_name` does no longer shadow `NameError`s
375
+ which happens during constant autoloading.
380
376
 
381
- *Francesco Rodriguez*
377
+ Fixes #9933.
382
378
 
383
- * Patched `Marshal#load` to work with constant autoloading. Fixes autoloading
384
- with cache stores that rely on `Marshal` (`MemCacheStore` and `FileStore`).
385
- Fixes #8167.
379
+ *Guo Xiang Tan*
386
380
 
387
- *Uriel Katz*
381
+ * Added instance_eval version to Object#try and Object#try!, so you can do this:
388
382
 
389
- * Make `Time.zone.parse` to work with JavaScript format date strings. *Andrew White*
383
+ person.try { name.first }
390
384
 
391
- * Add `DateTime#seconds_until_end_of_day` and `Time#seconds_until_end_of_day`
392
- as a complement for `seconds_from_midnight`; useful when setting expiration
393
- times for caches, e.g.:
385
+ instead of:
394
386
 
395
- <% cache('dashboard', expires_in: Date.current.seconds_until_end_of_day) do %>
396
- ...
387
+ person.try { |person| person.name.first }
397
388
 
398
- *Olek Janiszewski*
389
+ *DHH*, *Ari Pollak*
399
390
 
400
- * No longer proxy `ActiveSupport::Multibyte#class`. *Steve Klabnik*
391
+ * Fix the `ActiveSupport::Duration#instance_of?` method to return the right
392
+ value with the class itself since it was previously delegated to the
393
+ internal value.
401
394
 
402
- * Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from minitest instead. *Carlos Antonio da Silva*
395
+ *Robin Dupret*
403
396
 
404
- * `XmlMini.with_backend` now may be safely used with threads:
397
+ * Fix rounding errors with `#travel_to` by resetting the usec on any passed time to zero, so we only travel
398
+ with per-second precision, not anything deeper than that.
405
399
 
406
- Thread.new do
407
- XmlMini.with_backend("REXML") { rexml_power }
408
- end
409
- Thread.new do
410
- XmlMini.with_backend("LibXML") { libxml_power }
411
- end
400
+ *DHH*
412
401
 
413
- Each thread will use it's own backend.
402
+ * Fix DateTime comparison with `DateTime::Infinity` object.
414
403
 
415
- *Nikita Afanasenko*
404
+ *Rafael Mendonça França*
416
405
 
417
- * Dependencies no longer trigger `Kernel#autoload` in `remove_constant`. Fixes #8213. *Xavier Noria*
406
+ * Added Object#itself which returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes:
418
407
 
419
- * Simplify `mocha` integration and remove monkey-patches, bumping `mocha` to 0.13.0. *James Mead*
408
+ Event.public_send(state.presence_in([ :trashed, :drafted ]) || :itself).order(:created_at)
420
409
 
421
- * `#as_json` isolates options when encoding a hash. Fixes #8182.
410
+ *DHH*
422
411
 
423
- *Yves Senn*
412
+ * `Object#with_options` executes block in merging option context when
413
+ explicit receiver in not passed.
424
414
 
425
- * Deprecate `Hash#diff` in favor of minitest's #diff. *Steve Klabnik*
415
+ *Pavel Pravosud*
426
416
 
427
- * `Kernel#capture` can catch output from subprocesses. *Dmitry Vorotilin*
417
+ * Fixed a compatibility issue with the `Oj` gem when cherry-picking the file
418
+ `active_support/core_ext/object/json` without requiring `active_support/json`.
428
419
 
429
- * `to_xml` conversions now use builder's `tag!` method instead of explicit invocation of `method_missing`.
420
+ Fixes #16131.
430
421
 
431
- *Nikita Afanasenko*
422
+ *Godfrey Chan*
432
423
 
433
- * Fixed timezone mapping of the Solomon Islands. *Steve Klabnik*
424
+ * Make `Hash#with_indifferent_access` copy the default proc too.
434
425
 
435
- * Make callstack attribute optional in `ActiveSupport::Deprecation::Reporting`
436
- methods `warn` and `deprecation_warning`.
426
+ *arthurnn*, *Xanders*
437
427
 
438
- *Alexey Gaziev*
428
+ * Add `String#truncate_words` to truncate a string by a number of words.
439
429
 
440
- * Implement `HashWithIndifferentAccess#replace` so `key?` works correctly. *David Graham*
430
+ *Mohamed Osama*
441
431
 
442
- * Handle the possible permission denied errors `atomic.rb` might trigger due to its `chown`
443
- and `chmod` calls.
432
+ * Deprecate `capture` and `quietly`.
444
433
 
445
- *Daniele Sluijters*
434
+ These methods are not thread safe and may cause issues when used in threaded environments.
435
+ To avoid problems we are deprecating them.
446
436
 
447
- * `Hash#extract!` returns only those keys that present in the receiver.
437
+ *Tom Meier*
448
438
 
449
- {a: 1, b: 2}.extract!(:a, :x) # => {:a => 1}
439
+ * `DateTime#to_f` now preserves the fractional seconds instead of always
440
+ rounding to `.0`.
450
441
 
451
- *Mikhail Dieterle*
442
+ Fixes #15994.
452
443
 
453
- * `Hash#extract!` returns the same subclass, that the receiver is. I.e.
454
- `HashWithIndifferentAccess#extract!` returns a `HashWithIndifferentAccess` instance.
444
+ *John Paul Ashenfelter*
455
445
 
456
- *Mikhail Dieterle*
446
+ * Add `Hash#transform_values` to simplify a common pattern where the values of a
447
+ hash must change, but the keys are left the same.
457
448
 
458
- * Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead. *Brian Durand*
449
+ *Sean Griffin*
459
450
 
460
- * Tests tag the Rails log with the current test class and test case:
451
+ * Always instrument `ActiveSupport::Cache`.
461
452
 
462
- [SessionsControllerTest] [test_0002_sign in] Processing by SessionsController#create as HTML
463
- [SessionsControllerTest] [test_0002_sign in] ...
453
+ Since `ActiveSupport::Notifications` only instruments items when there
454
+ are attached subscribers, we don't need to disable instrumentation.
464
455
 
465
- *Jeremy Kemper*
456
+ *Peter Wagenet*
466
457
 
467
- * Add `logger.push_tags` and `.pop_tags` to complement `logger.tagged`:
458
+ * Make the `apply_inflections` method case-insensitive when checking
459
+ whether a word is uncountable or not.
468
460
 
469
- class Job
470
- def before
471
- Rails.logger.push_tags :jobs, self.class.name
472
- end
461
+ *Robin Dupret*
473
462
 
474
- def after
475
- Rails.logger.pop_tags 2
476
- end
477
- end
478
-
479
- *Jeremy Kemper*
463
+ * Make Dependencies pass a name to NameError error.
480
464
 
481
- * Allow delegation to the class using the `:class` keyword, replacing
482
- `self.class` usage:
465
+ *arthurnn*
483
466
 
484
- class User
485
- def self.hello
486
- "world"
487
- end
467
+ * Fixed `ActiveSupport::Cache::FileStore` exploding with long paths.
488
468
 
489
- delegate :hello, to: :class
490
- end
469
+ *Adam Panzer*, *Michael Grosser*
491
470
 
492
- *Marc-Andre Lafortune*
471
+ * Fixed `ActiveSupport::TimeWithZone#-` so precision is not unnecessarily lost
472
+ when working with objects with a nanosecond component.
493
473
 
494
- * `Date.beginning_of_week` thread local and `beginning_of_week` application
495
- config option added (default is Monday).
474
+ `ActiveSupport::TimeWithZone#-` should return the same result as if we were
475
+ using `Time#-`:
496
476
 
497
- *Innokenty Mikhailov*
477
+ Time.now.end_of_day - Time.now.beginning_of_day # => 86399.999999999
498
478
 
499
- * An optional block can be passed to `config_accessor` to set its default value
479
+ Before:
500
480
 
501
- class User
502
- include ActiveSupport::Configurable
481
+ Time.zone.now.end_of_day.nsec # => 999999999
482
+ Time.zone.now.end_of_day - Time.zone.now.beginning_of_day # => 86400.0
503
483
 
504
- config_accessor :hair_colors do
505
- [:brown, :black, :blonde, :red]
506
- end
507
- end
484
+ After:
508
485
 
509
- User.hair_colors # => [:brown, :black, :blonde, :red]
486
+ Time.zone.now.end_of_day - Time.zone.now.beginning_of_day
487
+ # => 86399.999999999
510
488
 
511
- *Larry Lv*
489
+ *Gordon Chan*
512
490
 
513
- * `ActiveSupport::Benchmarkable#silence` has been deprecated due to its lack of
514
- thread safety. It will be removed without replacement in Rails 4.1.
491
+ * Fixed precision error in NumberHelper when using Rationals.
515
492
 
516
- *Steve Klabnik*
493
+ Before:
517
494
 
518
- * An optional block can be passed to `Hash#deep_merge`. The block will be invoked
519
- for each duplicated key and used to resolve the conflict.
495
+ ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
496
+ # => "330.00"
520
497
 
521
- *Pranas Kiziela*
498
+ After:
522
499
 
523
- * `ActiveSupport::Deprecation` is now a class. It is possible to create an instance
524
- of deprecator. Backwards compatibility has been preserved.
500
+ ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
501
+ # => "333.33"
525
502
 
526
- You can choose which instance of the deprecator will be used.
503
+ See #15379.
527
504
 
528
- deprecate :method_name, deprecator: deprecator_instance
505
+ *Juanjo Bazán*
529
506
 
530
- You can use `ActiveSupport::Deprecation` in your gem.
507
+ * Removed deprecated `Numeric#ago` and friends
531
508
 
532
- require 'active_support/deprecation'
533
- require 'active_support/core_ext/module/deprecation'
509
+ Replacements:
534
510
 
535
- class MyGem
536
- def self.deprecator
537
- ActiveSupport::Deprecation.new('2.0', 'MyGem')
538
- end
511
+ 5.ago => 5.seconds.ago
512
+ 5.until => 5.seconds.until
513
+ 5.since => 5.seconds.since
514
+ 5.from_now => 5.seconds.from_now
539
515
 
540
- def old_method
541
- end
516
+ See #12389 for the history and rationale behind this.
542
517
 
543
- def new_method
544
- end
518
+ *Godfrey Chan*
545
519
 
546
- deprecate old_method: :new_method, deprecator: deprecator
547
- end
520
+ * DateTime `advance` now supports partial days.
548
521
 
549
- MyGem.new.old_method
550
- # => 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)
522
+ Before:
551
523
 
552
- *Piotr Niełacny & Robert Pankowecki*
524
+ DateTime.now.advance(days: 1, hours: 12)
553
525
 
554
- * `ERB::Util.html_escape` encodes single quote as `#39`. Decimal form has better support in old browsers. *Kalys Osmonov*
526
+ After:
555
527
 
556
- * `ActiveSupport::Callbacks`: deprecate monkey patch of object callbacks.
557
- Using the `filter` method like this:
528
+ DateTime.now.advance(days: 1.5)
558
529
 
559
- before_filter MyFilter.new
530
+ Fixes #12005.
560
531
 
561
- class MyFilter
562
- def filter(controller)
563
- end
564
- end
532
+ *Shay Davidson*
565
533
 
566
- Is now deprecated with recommendation to use the corresponding filter type
567
- (`#before`, `#after` or `#around`):
534
+ * `Hash#deep_transform_keys` and `Hash#deep_transform_keys!` now transform hashes
535
+ in nested arrays. This change also applies to `Hash#deep_stringify_keys`,
536
+ `Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and
537
+ `Hash#deep_symbolize_keys!`.
568
538
 
569
- before_filter MyFilter.new
539
+ *OZAWA Sakuro*
570
540
 
571
- class MyFilter
572
- def before(controller)
573
- end
574
- end
541
+ * Fixed confusing `DelegationError` in `Module#delegate`.
575
542
 
576
- *Bogdan Gusiev*
543
+ See #15186.
577
544
 
578
- * An optional block can be passed to `HashWithIndifferentAccess#update` and `#merge`.
579
- The block will be invoked for each duplicated key, and used to resolve the conflict,
580
- thus replicating the behaviour of the corresponding methods on the `Hash` class.
545
+ *Vladimir Yarotsky*
581
546
 
582
- *Leo Cassarani*
547
+ * Fixed `ActiveSupport::Subscriber` so that no duplicate subscriber is created
548
+ when a subscriber method is redefined.
583
549
 
584
- * Remove `j` alias for `ERB::Util#json_escape`.
585
- The `j` alias is already used for `ActionView::Helpers::JavaScriptHelper#escape_javascript`
586
- and both modules are included in the view context that would confuse the developers.
550
+ *Dennis Schön*
587
551
 
588
- *Akira Matsuda*
552
+ * Remove deprecated string based terminators for `ActiveSupport::Callbacks`.
589
553
 
590
- * Replace deprecated `memcache-client` gem with `dalli` in `ActiveSupport::Cache::MemCacheStore`.
554
+ *Eileen M. Uchitelle*
591
555
 
592
- *Guillermo Iguaran*
556
+ * Fixed an issue when using
557
+ `ActiveSupport::NumberHelper::NumberToDelimitedConverter` to
558
+ convert a value that is an `ActiveSupport::SafeBuffer` introduced
559
+ in 2da9d67.
593
560
 
594
- * Add default values to all `ActiveSupport::NumberHelper` methods, to avoid
595
- errors with empty locales or missing values.
561
+ See #15064.
596
562
 
597
- *Carlos Antonio da Silva*
563
+ *Mark J. Titorenko*
598
564
 
599
- * `ActiveSupport::JSON::Variable` is deprecated. Define your own `#as_json` and
600
- `#encode_json` methods for custom JSON string literals.
565
+ * `TimeZone#parse` defaults the day of the month to '1' if any other date
566
+ components are specified. This is more consistent with the behavior of
567
+ `Time#parse`.
601
568
 
602
- *Erich Menge*
569
+ *Ulysse Carion*
603
570
 
604
- * Add `String#indent`. *fxn & Ace Suares*
571
+ * `humanize` strips leading underscores, if any.
605
572
 
606
- * Inflections can now be defined per locale. `singularize` and `pluralize`
607
- accept locale as an extra argument.
573
+ Before:
608
574
 
609
- *David Celis*
575
+ '_id'.humanize # => ""
610
576
 
611
- * `Object#try` will now return `nil` instead of raise a `NoMethodError` if the
612
- receiving object does not implement the method, but you can still get the
613
- old behavior by using the new `Object#try!`.
577
+ After:
614
578
 
615
- *DHH*
579
+ '_id'.humanize # => "Id"
616
580
 
617
- * `ERB::Util.html_escape` now escapes single quotes. *Santiago Pastorino*
581
+ *Xavier Noria*
618
582
 
619
- * `Time#change` now works with time values with offsets other than UTC or the local time zone. *Andrew White*
583
+ * Fixed backward compatibility issues introduced in 326e652.
620
584
 
621
- * `ActiveSupport::Callbacks`: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev*
585
+ Empty Hash or Array should not be present in serialization result.
622
586
 
623
- * Add `Time#prev_quarter` and `Time#next_quarter` short-hands for `months_ago(3)` and `months_since(3)`. *SungHee Kang*
587
+ {a: []}.to_query # => ""
588
+ {a: {}}.to_query # => ""
624
589
 
625
- * Remove obsolete and unused `require_association` method from dependencies. *fxn*
590
+ For more info see #14948.
626
591
 
627
- * Add `:instance_accessor` option for `config_accessor`.
592
+ *Bogdan Gusiev*
628
593
 
629
- class User
630
- include ActiveSupport::Configurable
631
- config_accessor :allowed_access, instance_accessor: false
632
- end
594
+ * Add `Digest::UUID::uuid_v3` and `Digest::UUID::uuid_v5` to support stable
595
+ UUID fixtures on PostgreSQL.
633
596
 
634
- User.new.allowed_access = true # => NoMethodError
635
- User.new.allowed_access # => NoMethodError
597
+ *Roderick van Domburg*
636
598
 
637
- *Francesco Rodriguez*
599
+ * Fixed `ActiveSupport::Duration#eql?` so that `1.second.eql?(1.second)` is
600
+ true.
638
601
 
639
- * `ActionView::Helpers::NumberHelper` methods have been moved to `ActiveSupport::NumberHelper` and are now available via
640
- `Numeric#to_s`. `Numeric#to_s` now accepts the formatting options `:phone`, `:currency`, `:percentage`, `:delimited`,
641
- `:rounded`, `:human`, and `:human_size`.
602
+ This fixes the current situation of:
642
603
 
643
- *Andrew Mutz*
604
+ 1.second.eql?(1.second) # => false
644
605
 
645
- * Add `Hash#transform_keys`, `Hash#transform_keys!`, `Hash#deep_transform_keys`, and `Hash#deep_transform_keys!`. *Mark McSpadden*
606
+ `eql?` also requires that the other object is an `ActiveSupport::Duration`.
607
+ This requirement makes `ActiveSupport::Duration`'s behavior consistent with
608
+ the behavior of Ruby's numeric types:
646
609
 
647
- * Changed XML type `datetime` to `dateTime` (with upper case letter `T`). *Angelo Capilleri*
610
+ 1.eql?(1.0) # => false
611
+ 1.0.eql?(1) # => false
648
612
 
649
- * Add `:instance_accessor` option for `class_attribute`. *Alexey Vakhov*
613
+ 1.second.eql?(1) # => false (was true)
614
+ 1.eql?(1.second) # => false
650
615
 
651
- * `constantize` now looks in the ancestor chain. *Marc-Andre Lafortune & Andrew White*
616
+ { 1 => "foo", 1.0 => "bar" }
617
+ # => { 1 => "foo", 1.0 => "bar" }
652
618
 
653
- * Adds `Hash#deep_stringify_keys` and `Hash#deep_stringify_keys!` to convert all keys from a `Hash` instance into strings. *Lucas Húngaro*
619
+ { 1 => "foo", 1.second => "bar" }
620
+ # now => { 1 => "foo", 1.second => "bar" }
621
+ # was => { 1 => "bar" }
654
622
 
655
- * Adds `Hash#deep_symbolize_keys` and `Hash#deep_symbolize_keys!` to convert all keys from a `Hash` instance into symbols. *Lucas Húngaro*
623
+ And though the behavior of these hasn't changed, for reference:
656
624
 
657
- * `Object#try` can't call private methods. *Vasiliy Ermolovich*
625
+ 1 == 1.0 # => true
626
+ 1.0 == 1 # => true
658
627
 
659
- * `AS::Callbacks#run_callbacks` remove `key` argument. *Francesco Rodriguez*
628
+ 1 == 1.second # => true
629
+ 1.second == 1 # => true
660
630
 
661
- * `deep_dup` works more expectedly now and duplicates also values in `Hash` instances and elements in `Array` instances. *Alexey Gaziev*
631
+ *Emily Dobervich*
662
632
 
663
- * Inflector no longer applies ice -> ouse to words like "slice", "police", etc. *Wes Morgan*
633
+ * `ActiveSupport::SafeBuffer#prepend` acts like `String#prepend` and modifies
634
+ instance in-place, returning self. `ActiveSupport::SafeBuffer#prepend!` is
635
+ deprecated.
664
636
 
665
- * Add `ActiveSupport::Deprecations.behavior = :silence` to completely ignore Rails runtime deprecations. *twinturbo*
637
+ *Pavel Pravosud*
666
638
 
667
- * Make `Module#delegate` stop using `send` - can no longer delegate to private methods. *dasch*
639
+ * `HashWithIndifferentAccess` better respects `#to_hash` on objects it
640
+ receives. In particular, `.new`, `#update`, `#merge`, and `#replace` accept
641
+ objects which respond to `#to_hash`, even if those objects are not hashes
642
+ directly.
668
643
 
669
- * `ActiveSupport::Callbacks`: deprecate `:rescuable` option. *Bogdan Gusiev*
644
+ *Peter Jaros*
670
645
 
671
- * Adds `Integer#ordinal` to get the ordinal suffix string of an integer. *Tim Gildea*
646
+ * Deprecate `Class#superclass_delegating_accessor`, use `Class#class_attribute` instead.
672
647
 
673
- * `ActiveSupport::Callbacks`: `:per_key` option is no longer supported. *Bogdan Gusiev*
648
+ *Akshay Vishnoi*
674
649
 
675
- * `ActiveSupport::Callbacks#define_callbacks`: add `:skip_after_callbacks_if_terminated` option. *Bogdan Gusiev*
650
+ * Ensure classes which `include Enumerable` get `#to_json` in addition to
651
+ `#as_json`.
676
652
 
677
- * Add `html_escape_once` to `ERB::Util`, and delegate the `escape_once` tag helper to it. *Carlos Antonio da Silva*
653
+ *Sammy Larbi*
678
654
 
679
- * Deprecates the compatibility method `Module#local_constant_names`,
680
- use `Module#local_constants` instead (which returns symbols). *Xavier Noria*
655
+ * Change the signature of `fetch_multi` to return a hash rather than an
656
+ array. This makes it consistent with the output of `read_multi`.
681
657
 
682
- * Deletes the compatibility method `Module#method_names`,
683
- use `Module#methods` from now on (which returns symbols). *Xavier Noria*
658
+ *Parker Selbert*
684
659
 
685
- * Deletes the compatibility method `Module#instance_method_names`,
686
- use `Module#instance_methods` from now on (which returns symbols). *Xavier Noria*
660
+ * Introduce `Concern#class_methods` as a sleek alternative to clunky
661
+ `module ClassMethods`. Add `Kernel#concern` to define at the toplevel
662
+ without chunky `module Foo; extend ActiveSupport::Concern` boilerplate.
687
663
 
688
- * `BufferedLogger` is deprecated. Use `ActiveSupport::Logger`, or the logger
689
- from the Ruby standard library.
664
+ # app/models/concerns/authentication.rb
665
+ concern :Authentication do
666
+ included do
667
+ after_create :generate_private_key
668
+ end
690
669
 
691
- *Aaron Patterson*
670
+ class_methods do
671
+ def authenticate(credentials)
672
+ # ...
673
+ end
674
+ end
692
675
 
693
- * Unicode database updated to 6.1.0. *Norman Clarke*
676
+ def generate_private_key
677
+ # ...
678
+ end
679
+ end
694
680
 
695
- * Adds `encode_big_decimal_as_string` option to force JSON serialization of `BigDecimal` as numeric instead
696
- of wrapping them in strings for safety.
681
+ # app/models/user.rb
682
+ class User < ActiveRecord::Base
683
+ include Authentication
684
+ end
697
685
 
698
- * Optimize log subscribers to check log level before doing any processing. *Brian Durand*
686
+ *Jeremy Kemper*
699
687
 
700
- Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/activesupport/CHANGELOG.md) for previous changes.
688
+ Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activesupport/CHANGELOG.md) for previous changes.