activesupport 4.2.11.3 → 5.0.0.beta1

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 (174) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +309 -485
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +2 -3
  5. data/lib/active_support.rb +8 -15
  6. data/lib/active_support/array_inquirer.rb +44 -0
  7. data/lib/active_support/backtrace_cleaner.rb +1 -1
  8. data/lib/active_support/cache.rb +59 -72
  9. data/lib/active_support/cache/file_store.rb +27 -19
  10. data/lib/active_support/cache/mem_cache_store.rb +71 -60
  11. data/lib/active_support/cache/memory_store.rb +16 -21
  12. data/lib/active_support/cache/null_store.rb +1 -4
  13. data/lib/active_support/cache/strategy/local_cache.rb +31 -20
  14. data/lib/active_support/callbacks.rb +107 -111
  15. data/lib/active_support/concern.rb +1 -1
  16. data/lib/active_support/concurrency/latch.rb +7 -15
  17. data/lib/active_support/concurrency/share_lock.rb +142 -0
  18. data/lib/active_support/configurable.rb +1 -0
  19. data/lib/active_support/core_ext.rb +2 -1
  20. data/lib/active_support/core_ext/array.rb +1 -0
  21. data/lib/active_support/core_ext/array/access.rb +13 -1
  22. data/lib/active_support/core_ext/array/conversions.rb +6 -4
  23. data/lib/active_support/core_ext/array/inquiry.rb +17 -0
  24. data/lib/active_support/core_ext/array/wrap.rb +5 -4
  25. data/lib/active_support/core_ext/big_decimal/conversions.rb +8 -10
  26. data/lib/active_support/core_ext/class.rb +0 -1
  27. data/lib/active_support/core_ext/class/attribute.rb +10 -9
  28. data/lib/active_support/core_ext/class/subclasses.rb +5 -2
  29. data/lib/active_support/core_ext/date.rb +1 -1
  30. data/lib/active_support/core_ext/date/blank.rb +12 -0
  31. data/lib/active_support/core_ext/date/calculations.rb +1 -1
  32. data/lib/active_support/core_ext/date/conversions.rb +3 -3
  33. data/lib/active_support/core_ext/date_and_time/calculations.rb +93 -27
  34. data/lib/active_support/core_ext/date_and_time/zones.rb +1 -2
  35. data/lib/active_support/core_ext/date_time.rb +1 -1
  36. data/lib/active_support/core_ext/date_time/blank.rb +12 -0
  37. data/lib/active_support/core_ext/date_time/calculations.rb +7 -23
  38. data/lib/active_support/core_ext/date_time/conversions.rb +2 -0
  39. data/lib/active_support/core_ext/enumerable.rb +27 -17
  40. data/lib/active_support/core_ext/file/atomic.rb +30 -25
  41. data/lib/active_support/core_ext/hash/compact.rb +15 -19
  42. data/lib/active_support/core_ext/hash/conversions.rb +21 -2
  43. data/lib/active_support/core_ext/hash/deep_merge.rb +1 -1
  44. data/lib/active_support/core_ext/hash/except.rb +9 -8
  45. data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -1
  46. data/lib/active_support/core_ext/hash/keys.rb +22 -18
  47. data/lib/active_support/core_ext/hash/slice.rb +1 -1
  48. data/lib/active_support/core_ext/hash/transform_values.rb +13 -7
  49. data/lib/active_support/core_ext/integer/time.rb +1 -1
  50. data/lib/active_support/core_ext/kernel.rb +0 -1
  51. data/lib/active_support/core_ext/kernel/debugger.rb +3 -10
  52. data/lib/active_support/core_ext/kernel/reporting.rb +0 -84
  53. data/lib/active_support/core_ext/load_error.rb +4 -2
  54. data/lib/active_support/core_ext/marshal.rb +8 -13
  55. data/lib/active_support/core_ext/module.rb +1 -0
  56. data/lib/active_support/core_ext/module/aliasing.rb +6 -1
  57. data/lib/active_support/core_ext/module/anonymous.rb +10 -1
  58. data/lib/active_support/core_ext/module/attr_internal.rb +2 -5
  59. data/lib/active_support/core_ext/module/attribute_accessors.rb +7 -7
  60. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +141 -0
  61. data/lib/active_support/core_ext/module/concerning.rb +4 -4
  62. data/lib/active_support/core_ext/module/delegation.rb +7 -14
  63. data/lib/active_support/core_ext/module/method_transplanting.rb +3 -13
  64. data/lib/active_support/core_ext/module/qualified_const.rb +30 -12
  65. data/lib/active_support/core_ext/module/remove_method.rb +23 -0
  66. data/lib/active_support/core_ext/name_error.rb +15 -2
  67. data/lib/active_support/core_ext/numeric.rb +1 -0
  68. data/lib/active_support/core_ext/numeric/bytes.rb +20 -0
  69. data/lib/active_support/core_ext/numeric/conversions.rb +12 -23
  70. data/lib/active_support/core_ext/numeric/inquiry.rb +26 -0
  71. data/lib/active_support/core_ext/numeric/time.rb +20 -0
  72. data/lib/active_support/core_ext/object.rb +0 -1
  73. data/lib/active_support/core_ext/object/blank.rb +11 -2
  74. data/lib/active_support/core_ext/object/deep_dup.rb +10 -3
  75. data/lib/active_support/core_ext/object/duplicable.rb +39 -70
  76. data/lib/active_support/core_ext/object/inclusion.rb +2 -2
  77. data/lib/active_support/core_ext/object/instance_variables.rb +1 -1
  78. data/lib/active_support/core_ext/object/json.rb +9 -7
  79. data/lib/active_support/core_ext/object/to_query.rb +1 -1
  80. data/lib/active_support/core_ext/object/try.rb +67 -21
  81. data/lib/active_support/core_ext/object/with_options.rb +1 -1
  82. data/lib/active_support/core_ext/range/conversions.rb +18 -6
  83. data/lib/active_support/core_ext/range/each.rb +16 -18
  84. data/lib/active_support/core_ext/range/include_range.rb +20 -20
  85. data/lib/active_support/core_ext/securerandom.rb +23 -0
  86. data/lib/active_support/core_ext/string/access.rb +1 -1
  87. data/lib/active_support/core_ext/string/behavior.rb +1 -1
  88. data/lib/active_support/core_ext/string/conversions.rb +2 -2
  89. data/lib/active_support/core_ext/string/filters.rb +1 -2
  90. data/lib/active_support/core_ext/string/inflections.rb +23 -5
  91. data/lib/active_support/core_ext/string/multibyte.rb +11 -7
  92. data/lib/active_support/core_ext/string/output_safety.rb +8 -9
  93. data/lib/active_support/core_ext/string/strip.rb +3 -6
  94. data/lib/active_support/core_ext/struct.rb +3 -6
  95. data/lib/active_support/core_ext/time.rb +0 -2
  96. data/lib/active_support/core_ext/time/calculations.rb +18 -16
  97. data/lib/active_support/core_ext/time/conversions.rb +4 -2
  98. data/lib/active_support/core_ext/time/marshal.rb +2 -29
  99. data/lib/active_support/core_ext/time/zones.rb +19 -3
  100. data/lib/active_support/core_ext/uri.rb +1 -3
  101. data/lib/active_support/dependencies.rb +79 -44
  102. data/lib/active_support/dependencies/interlock.rb +47 -0
  103. data/lib/active_support/deprecation/behaviors.rb +12 -0
  104. data/lib/active_support/deprecation/method_wrappers.rb +42 -16
  105. data/lib/active_support/deprecation/proxy_wrappers.rb +47 -24
  106. data/lib/active_support/deprecation/reporting.rb +13 -2
  107. data/lib/active_support/duration.rb +5 -8
  108. data/lib/active_support/evented_file_update_checker.rb +150 -0
  109. data/lib/active_support/file_update_checker.rb +1 -1
  110. data/lib/active_support/gem_version.rb +5 -5
  111. data/lib/active_support/hash_with_indifferent_access.rb +15 -17
  112. data/lib/active_support/i18n_railtie.rb +25 -4
  113. data/lib/active_support/inflector/inflections.rb +36 -5
  114. data/lib/active_support/inflector/methods.rb +87 -89
  115. data/lib/active_support/inflector/transliterate.rb +36 -21
  116. data/lib/active_support/json/decoding.rb +2 -8
  117. data/lib/active_support/json/encoding.rb +0 -50
  118. data/lib/active_support/key_generator.rb +4 -4
  119. data/lib/active_support/log_subscriber.rb +1 -1
  120. data/lib/active_support/log_subscriber/test_helper.rb +3 -3
  121. data/lib/active_support/logger.rb +4 -52
  122. data/lib/active_support/logger_silence.rb +3 -5
  123. data/lib/active_support/message_encryptor.rb +4 -11
  124. data/lib/active_support/message_verifier.rb +64 -8
  125. data/lib/active_support/multibyte/chars.rb +12 -3
  126. data/lib/active_support/multibyte/unicode.rb +6 -8
  127. data/lib/active_support/notifications.rb +2 -2
  128. data/lib/active_support/notifications/fanout.rb +5 -5
  129. data/lib/active_support/notifications/instrumenter.rb +19 -2
  130. data/lib/active_support/number_helper.rb +21 -15
  131. data/lib/active_support/number_helper/number_to_currency_converter.rb +4 -4
  132. data/lib/active_support/number_helper/number_to_delimited_converter.rb +7 -2
  133. data/lib/active_support/number_helper/number_to_human_converter.rb +6 -4
  134. data/lib/active_support/number_helper/number_to_human_size_converter.rb +5 -1
  135. data/lib/active_support/number_helper/number_to_percentage_converter.rb +1 -1
  136. data/lib/active_support/number_helper/number_to_rounded_converter.rb +28 -25
  137. data/lib/active_support/ordered_options.rb +15 -1
  138. data/lib/active_support/per_thread_registry.rb +3 -0
  139. data/lib/active_support/rails.rb +2 -2
  140. data/lib/active_support/railtie.rb +6 -1
  141. data/lib/active_support/rescuable.rb +4 -4
  142. data/lib/active_support/security_utils.rb +0 -7
  143. data/lib/active_support/string_inquirer.rb +1 -1
  144. data/lib/active_support/subscriber.rb +5 -10
  145. data/lib/active_support/tagged_logging.rb +3 -1
  146. data/lib/active_support/test_case.rb +13 -25
  147. data/lib/active_support/testing/assertions.rb +15 -13
  148. data/lib/active_support/testing/autorun.rb +8 -1
  149. data/lib/active_support/testing/composite_filter.rb +54 -0
  150. data/lib/active_support/testing/deprecation.rb +9 -8
  151. data/lib/active_support/testing/file_fixtures.rb +34 -0
  152. data/lib/active_support/testing/isolation.rb +22 -8
  153. data/lib/active_support/testing/method_call_assertions.rb +41 -0
  154. data/lib/active_support/testing/stream.rb +42 -0
  155. data/lib/active_support/testing/time_helpers.rb +6 -6
  156. data/lib/active_support/time_with_zone.rb +135 -53
  157. data/lib/active_support/values/time_zone.rb +80 -46
  158. data/lib/active_support/values/unicode_tables.dat +0 -0
  159. data/lib/active_support/xml_mini.rb +15 -30
  160. data/lib/active_support/xml_mini/jdom.rb +1 -1
  161. data/lib/active_support/xml_mini/libxml.rb +5 -3
  162. data/lib/active_support/xml_mini/libxmlsax.rb +4 -1
  163. data/lib/active_support/xml_mini/nokogiri.rb +5 -3
  164. data/lib/active_support/xml_mini/nokogirisax.rb +3 -1
  165. data/lib/active_support/xml_mini/rexml.rb +3 -1
  166. metadata +57 -21
  167. data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +0 -16
  168. data/lib/active_support/core_ext/class/delegating_attributes.rb +0 -45
  169. data/lib/active_support/core_ext/date_and_time/compatibility.rb +0 -15
  170. data/lib/active_support/core_ext/date_time/compatibility.rb +0 -16
  171. data/lib/active_support/core_ext/object/itself.rb +0 -15
  172. data/lib/active_support/core_ext/thread.rb +0 -86
  173. data/lib/active_support/core_ext/time/compatibility.rb +0 -14
  174. data/lib/active_support/logger_thread_safe_level.rb +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: e5927887f8de9d6b13175ee528ab4606a7975d7b4eb27c7365c3ed5bbc620183
4
- data.tar.gz: 1f4c3a900e5f84241a557376ecb5850a5c9c6b86be17f6929397871a9ae5f925
2
+ SHA1:
3
+ metadata.gz: 25266c8f8202c7032187cc3b6cf443cb24a2d552
4
+ data.tar.gz: 6e9e0a596447ba31f6e55400dba1efece7b0ace2
5
5
  SHA512:
6
- metadata.gz: d4bf38be75e38c3e9fdabdac8220b0ec283a7828778c9d1aaa6c084eed3a31ad677d12ef23d59aeb83188f258f6436d2ac50a6f1240e0dbbcdd01d7476694b5a
7
- data.tar.gz: 6fd1b23cf9c7d1600ddf239616dbc86253de33a2b1ee73a82892f22cef0af1010920582a76ef5e1995d1188e451980700427cc932b261fdc99fcba9c0ba79914
6
+ metadata.gz: 3091306ea5f246815b8e76cb6800daea7c84cf8f920f1ef5367e172efc81a7384e702c02d1e7907d96bdbaa17ec9be7fb88e07903b862a8e286e1f051a4ea260
7
+ data.tar.gz: ebd7095f3ef49c3e175fd7fb04b6070d4fe7dd4aaecc837475e3808c75e6bfc94e0ed620df673e25d497cc1ba855a81dd1053f7764c1fad885f861e976534e16
@@ -1,204 +1,194 @@
1
- ## Rails 4.2.11.3 (May 15, 2020) ##
1
+ ## Rails 5.0.0.beta1 (December 18, 2015) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 4.2.11.2 (May 15, 2020) ##
7
-
8
- * No changes.
9
-
10
-
11
- ## Rails 4.2.11.1 (March 11, 2019) ##
12
-
13
- * No changes.
14
-
15
-
16
- ## Rails 4.2.11 (November 27, 2018) ##
17
-
18
- * No changes.
19
-
20
-
21
- ## Rails 4.2.10 (September 27, 2017) ##
22
-
23
- * No changes.
24
-
25
-
26
- ## Rails 4.2.9 (June 26, 2017) ##
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`.
32
-
33
- *Kevin McPhillips* & *Andrew White*
34
-
35
- * Restore the return type of `DateTime#utc`
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.
43
-
44
- *Andrew White*
45
-
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.
49
-
50
- *Jeff Latz*
6
+ * Add thread_m/cattr_accessor/reader/writer suite of methods for declaring class and module variables that live per-thread.
7
+ This makes it easy to declare per-thread globals that are encapsulated. Note: This is a sharp edge. A wild proliferation
8
+ of globals is A Bad Thing. But like other sharp tools, when it's right, it's right.
9
+
10
+ Here's an example of a simple event tracking system where the object being tracked needs not pass a creator that it
11
+ doesn't need itself along:
12
+
13
+ module Current
14
+ thread_mattr_accessor :account
15
+ thread_mattr_accessor :user
16
+
17
+ def self.reset() self.account = self.user = nil end
18
+ end
19
+
20
+ class ApplicationController < ActiveController::Base
21
+ before_action :set_current
22
+ after_action { Current.reset }
23
+
24
+ private
25
+ def set_current
26
+ Current.account = Account.find(params[:account_id])
27
+ Current.user = Current.account.users.find(params[:user_id])
28
+ end
29
+ end
30
+
31
+ class MessagesController < ApplicationController
32
+ def create
33
+ @message = Message.create!(message_params)
34
+ end
35
+ end
36
+
37
+ class Message < ApplicationRecord
38
+ has_many :events
39
+ after_create :track_created
40
+
41
+ private
42
+ def track_created
43
+ events.create! origin: self, action: :create
44
+ end
45
+ end
51
46
 
52
- * Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
47
+ class Event < ApplicationRecord
48
+ belongs_to :creator, class_name: 'User'
49
+ before_validation { self.creator ||= Current.user }
50
+ end
53
51
 
54
- *Adam Rice*
52
+ *DHH*
55
53
 
56
- * `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
57
- `Time.now` and `Date.today`.
58
54
 
59
- *Yuki Nishijima*
55
+ * Deprecated `Module#qualified_const_` in favour of the builtin Module#const_
56
+ methods.
60
57
 
58
+ *Genadi Samokovarov*
61
59
 
62
- ## Rails 4.2.8 (February 21, 2017) ##
60
+ * Deprecate passing string to define callback.
63
61
 
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.
62
+ *Yuichiro Kaneko*
73
63
 
74
- *Andrew White*
64
+ * `ActiveSupport::Cache::Store#namespaced_key`,
65
+ `ActiveSupport::Cache::MemCachedStore#escape_key`, and
66
+ `ActiveSupport::Cache::FileStore#key_file_path`
67
+ are deprecated and replaced with `normalize_key` that now calls `super`.
75
68
 
76
- * Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
69
+ `ActiveSupport::Cache::LocaleCache#set_cache_value` is deprecated and replaced with `write_cache_value`.
77
70
 
78
- *Andrew White*
71
+ *Michael Grosser*
79
72
 
80
- * Add additional aliases for `DateTime#utc` to mirror the ones on
81
- `ActiveSupport::TimeWithZone` and `Time`.
73
+ * Implements an evented file watcher to asynchronously detect changes in the
74
+ application source code, routes, locales, etc.
82
75
 
83
- *Andrew White*
76
+ This watcher is disabled by default, applications my enable it in the configuration:
84
77
 
85
- * Add `DateTime#localtime` to return an instance of `Time` in the system's
86
- local timezone. Also aliased to `getlocal`.
78
+ # config/environments/development.rb
79
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
87
80
 
88
- *Andrew White*, *Yuichiro Kaneko*
81
+ This feature depends on the [listen](https://github.com/guard/listen) gem:
89
82
 
90
- * Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.
83
+ group :development do
84
+ gem 'listen', '~> 3.0.5'
85
+ end
91
86
 
92
- *Andrew White*
87
+ *Puneet Agarwal* and *Xavier Noria*
93
88
 
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:
89
+ * Added `Time.days_in_year` to return the number of days in the given year, or the
90
+ current year if no argument is provided.
99
91
 
100
- >> ENV['TZ'] = 'US/Eastern'
92
+ *Jon Pascoe*
101
93
 
102
- >> "2016-04-23T10:23:12.000Z".to_time
103
- => "2016-04-23T06:23:12.000-04:00"
94
+ * Updated `parameterize` to preserve the case of a string, optionally.
104
95
 
105
- >> ActiveSupport.to_time_preserves_timezone = true
96
+ Example:
106
97
 
107
- >> "2016-04-23T10:23:12.000Z".to_time
108
- => "2016-04-23T10:23:12.000Z"
98
+ parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth"
99
+ parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
109
100
 
110
- Fixes #24617.
101
+ *Swaathi Kakarla*
111
102
 
112
- *Andrew White*
103
+ * `HashWithIndifferentAccess.new` respects the default value or proc on objects
104
+ that respond to `#to_hash`. `.new_from_hash_copying_default` simply invokes `.new`.
105
+ All calls to `.new_from_hash_copying_default` are replaced with `.new`.
113
106
 
114
- * Add `init_with` to `ActiveSupport::TimeWithZone` and `ActiveSupport::TimeZone`
107
+ *Gordon Chan*
115
108
 
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
+ * Change Integer#year to return a Fixnum instead of a Float to improve
110
+ consistency.
119
111
 
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.
112
+ Integer#years returned a Float while the rest of the accompanying methods
113
+ (days, weeks, months, etc.) return a Fixnum.
126
114
 
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.
115
+ Before:
131
116
 
132
- Fixes #26296.
117
+ 1.year # => 31557600.0
133
118
 
134
- *Andrew White*
119
+ After:
135
120
 
136
- * Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
121
+ 1.year # => 31557600
137
122
 
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:
123
+ *Konstantinos Rousis*
142
124
 
143
- Time.zone = "US/Eastern"
125
+ * Handle invalid UTF-8 strings when HTML escaping
144
126
 
145
- t = Time.zone.local(2016,11,6,1)
146
- # => Sun, 06 Nov 2016 01:00:00 EDT -05:00
127
+ Use `ActiveSupport::Multibyte::Unicode.tidy_bytes` to handle invalid UTF-8
128
+ strings in `ERB::Util.unwrapped_html_escape` and `ERB::Util.html_escape_once`.
129
+ Prevents user-entered input passed from a querystring into a form field from
130
+ causing invalid byte sequence errors.
147
131
 
148
- t.in(1.hour)
149
- # => Sun, 06 Nov 2016 01:00:00 EST -05:00
132
+ *Grey Baker*
150
133
 
151
- Fixes #26580.
134
+ * Update `ActiveSupport::Multibyte::Chars#slice!` to return `nil` if the
135
+ arguments are out of bounds, to mirror the behavior of `String#slice!`
152
136
 
153
- *Thomas Balthazar*
137
+ *Gourav Tiwari*
154
138
 
139
+ * Fix `number_to_human` so that 999999999 rounds to "1 Billion" instead of
140
+ "1000 Million".
155
141
 
156
- ## Rails 4.2.7 (July 12, 2016) ##
142
+ *Max Jacobson*
157
143
 
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.
144
+ * Fix `ActiveSupport::Deprecation#deprecate_methods` to report using the
145
+ current deprecator instance, where applicable.
161
146
 
162
- *Kevin McPhillips*
147
+ *Brandon Dunne*
163
148
 
164
- * Backported `ActiveSupport::LoggerThreadSafeLevel`. Assigning the
165
- `Rails.logger.level` is now thread safe.
149
+ * `Cache#fetch` instrumentation marks whether it was a `:hit`.
166
150
 
167
- *Kevin McPhillips*
151
+ *Robin Clowers*
168
152
 
169
- * Fixed a problem with ActiveSupport::SafeBuffer.titleize calling capitalize
170
- on nil.
153
+ * `assert_difference` and `assert_no_difference` now returns the result of the
154
+ yielded block.
171
155
 
172
- *Brian McManus*
156
+ Example:
173
157
 
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.
158
+ post = assert_difference -> { Post.count }, 1 do
159
+ Post.create
160
+ end
177
161
 
178
- *Alexey Shein*
162
+ *Lucas Mazza*
179
163
 
180
- * Prevent `Marshal.load` from looping infinitely when trying to autoload a constant
181
- which resolves to a different name.
164
+ * Short-circuit `blank?` on date and time values since they are never blank.
182
165
 
183
- *Olek Janiszewski*
166
+ Fixes #21657
184
167
 
168
+ *Andrew White*
185
169
 
186
- ## Rails 4.2.6 (March 07, 2016) ##
170
+ * Replaced deprecated `ThreadSafe::Cache` with its successor `Concurrent::Map` now that
171
+ the thread_safe gem has been merged into concurrent-ruby.
187
172
 
188
- * No changes.
173
+ *Jerry D'Antonio*
189
174
 
175
+ * Updated Unicode version to 8.0.0
190
176
 
191
- ## Rails 4.2.5.2 (February 26, 2016) ##
177
+ *Anshul Sharma*
192
178
 
193
- * No changes.
179
+ * `number_to_currency` and `number_with_delimiter` now accept custom `delimiter_pattern` option
180
+ to handle placement of delimiter, to support currency formats like INR
194
181
 
182
+ Example:
195
183
 
196
- ## Rails 4.2.5.1 (January 25, 2015) ##
184
+ number_to_currency(1230000, delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/, unit: '₹', format: "%u %n")
185
+ # => '₹ 12,30,000.00'
197
186
 
198
- * No changes.
187
+ *Vipul A M*
199
188
 
189
+ * Deprecate `:prefix` option of `number_to_human_size` with no replacement.
200
190
 
201
- ## Rails 4.2.5 (November 12, 2015) ##
191
+ *Jean Boussier*
202
192
 
203
193
  * Fix `TimeWithZone#eql?` to properly handle `TimeWithZone` created from `DateTime`:
204
194
  twz = DateTime.now.in_time_zone
@@ -208,21 +198,19 @@
208
198
 
209
199
  *Roque Pinel*
210
200
 
211
- * Handle invalid UTF-8 characters in `MessageVerifier.verify`.
212
-
213
- *Roque Pinel*, *Grey Baker*
201
+ * ActiveSupport::HashWithIndifferentAccess `select` and `reject` will now return
202
+ enumerator if called without block.
214
203
 
204
+ Fixes #20095
215
205
 
216
- ## Rails 4.2.4 (August 24, 2015) ##
206
+ *Bernard Potocki*
217
207
 
218
- * Fix a `SystemStackError` when encoding an `Enumerable` with `json` gem and
219
- with the Active Support JSON encoder loaded.
208
+ * Removed `ActiveSupport::Concurrency::Latch`, superseded by `Concurrent::CountDownLatch`
209
+ from the concurrent-ruby gem.
220
210
 
221
- Fixes #20775.
211
+ *Jerry D'Antonio*
222
212
 
223
- *Sammy Larbi*, *Prathamesh Sonpatki*
224
-
225
- * Fix not calling `#default` on `HashWithIndifferentAcess#to_hash` when only
213
+ * Fix not calling `#default` on `HashWithIndifferentAccess#to_hash` when only
226
214
  `default_proc` is set, which could raise.
227
215
 
228
216
  *Simon Eskildsen*
@@ -231,458 +219,294 @@
231
219
 
232
220
  *Simon Eskildsen*
233
221
 
234
-
235
- ## Rails 4.2.3 (June 25, 2015) ##
236
-
237
222
  * Fix a range of values for parameters of the Time#change
238
223
 
239
224
  *Nikolay Kondratyev*
240
225
 
241
- * Add some missing `require 'active_support/deprecation'`
226
+ * Add `Enumerable#pluck` to get the same values from arrays as from ActiveRecord
227
+ associations.
242
228
 
243
- *Akira Matsuda*
244
-
245
-
246
- ## Rails 4.2.2 (June 16, 2015) ##
247
-
248
- * Fix XSS vulnerability in `ActiveSupport::JSON.encode` method.
249
-
250
- CVE-2015-3226.
251
-
252
- *Rafael Mendonça França*
253
-
254
- * Fix denial of service vulnerability in the XML processing.
255
-
256
- CVE-2015-3227.
257
-
258
- *Aaron Patterson*
259
-
260
-
261
- ## Rails 4.2.1 (March 19, 2015) ##
229
+ Fixes #20339.
262
230
 
263
- * Fixed a problem where String#truncate_words would get stuck with a complex
264
- string.
265
-
266
- *Henrik Nygren*
231
+ *Kevin Deisz*
267
232
 
268
- * Fixed a roundtrip problem with AS::SafeBuffer where primitive-like strings
269
- will be dumped as primitives:
233
+ * Add a bang version to `ActiveSupport::OrderedOptions` get methods which will raise
234
+ an `KeyError` if the value is `.blank?`
270
235
 
271
236
  Before:
272
237
 
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
-
279
- After:
280
-
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"
286
-
287
- *Godfrey Chan*
288
-
289
- * Replace fixed `:en` with `I18n.default_locale` in `Duration#inspect`.
290
-
291
- *Dominik Masur*
292
-
293
- * Add missing time zone definitions for Russian Federation and sync them
294
- with `zone.tab` file from tzdata version 2014j (latest).
295
-
296
- *Andrey Novikov*
297
-
298
-
299
- ## Rails 4.2.0 (December 20, 2014) ##
300
-
301
- * The decorated `load` and `require` methods are now kept private.
302
-
303
- Fixes #17553.
304
-
305
- *Xavier Noria*
306
-
307
- * `String#remove` and `String#remove!` accept multiple arguments.
308
-
309
- *Pavel Pravosud*
310
-
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.
313
-
314
- *Pablo Herrero*
315
-
316
- * Corrected `Inflector#underscore` handling of multiple successive acroynms.
317
-
318
- *James Le Cuirot*
319
-
320
- * Delegation now works with ruby reserved words passed to `:to` option.
321
-
322
- Fixes #16956.
323
-
324
- *Agis Anastasopoulos*
325
-
326
- * Added method `#eql?` to `ActiveSupport::Duration`, in addition to `#==`.
327
-
328
- Currently, the following returns `false`, contrary to expectation:
329
-
330
- 1.minute.eql?(1.minute)
331
-
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.
335
-
336
- 1.minute.eql?(60.seconds) # => true
337
- 1.minute.eql?(60) # => false
338
-
339
- *Joost Lubach*
340
-
341
- * `Time#change` can now change nanoseconds (`:nsec`) as a higher-precision
342
- alternative to microseconds (`:usec`).
343
-
344
- *Agis Anastasooulos*
345
-
346
- * `MessageVerifier.new` raises an appropriate exception if the secret is `nil`.
347
- This prevents `MessageVerifier#generate` from raising a cryptic error later on.
348
-
349
- *Kostiantyn Kahanskyi*
350
-
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
-
355
- *Akira Matsuda*, *Godfrey Chan*
356
-
357
- * Fixed a bug in `Inflector#underscore` where acroynms in nested constant names
358
- are incorrectly parsed as camelCase.
359
-
360
- Fixes #8015.
361
-
362
- *Fred Wu*, *Matthew Draper*
363
-
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.
366
-
367
- *Agis Anastasopoulos*
368
-
369
- * `Method` objects now report themselves as not `duplicable?`. This allows
370
- hashes and arrays containing `Method` objects to be `deep_dup`ed.
371
-
372
- *Peter Jaros*
373
-
374
- * `determine_constant_from_test_name` does no longer shadow `NameError`s
375
- which happens during constant autoloading.
376
-
377
- Fixes #9933.
378
-
379
- *Guo Xiang Tan*
380
-
381
- * Added instance_eval version to Object#try and Object#try!, so you can do this:
382
-
383
- person.try { name.first }
384
-
385
- instead of:
238
+ if (slack_url = Rails.application.secrets.slack_url).present?
239
+ # Do something worthwhile
240
+ else
241
+ # Raise as important secret password is not specified
242
+ end
386
243
 
387
- person.try { |person| person.name.first }
244
+ After:
388
245
 
389
- *DHH*, *Ari Pollak*
246
+ slack_url = Rails.application.secrets.slack_url!
390
247
 
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.
248
+ *Aditya Sanghi*, *Gaurish Sharma*
394
249
 
395
- *Robin Dupret*
250
+ * Remove deprecated `Class#superclass_delegating_accessor`.
251
+ Use `Class#class_attribute` instead.
396
252
 
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.
253
+ *Akshay Vishnoi*
399
254
 
400
- *DHH*
255
+ * Patch `Delegator` to work with `#try`.
401
256
 
402
- * Fix DateTime comparison with `DateTime::Infinity` object.
257
+ Fixes #5790.
403
258
 
404
- *Rafael Mendonça França*
259
+ *Nate Smith*
405
260
 
406
- * Added Object#itself which returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes:
261
+ * Add `Integer#positive?` and `Integer#negative?` query methods
262
+ in the vein of `Fixnum#zero?`.
407
263
 
408
- Event.public_send(state.presence_in([ :trashed, :drafted ]) || :itself).order(:created_at)
264
+ This makes it nicer to do things like `bunch_of_numbers.select(&:positive?)`.
409
265
 
410
266
  *DHH*
411
267
 
412
- * `Object#with_options` executes block in merging option context when
413
- explicit receiver in not passed.
414
-
415
- *Pavel Pravosud*
416
-
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`.
419
-
420
- Fixes #16131.
421
-
422
- *Godfrey Chan*
423
-
424
- * Make `Hash#with_indifferent_access` copy the default proc too.
425
-
426
- *arthurnn*, *Xanders*
427
-
428
- * Add `String#truncate_words` to truncate a string by a number of words.
429
-
430
- *Mohamed Osama*
431
-
432
- * Deprecate `capture` and `quietly`.
433
-
434
- These methods are not thread safe and may cause issues when used in threaded environments.
435
- To avoid problems we are deprecating them.
436
-
437
- *Tom Meier*
438
-
439
- * `DateTime#to_f` now preserves the fractional seconds instead of always
440
- rounding to `.0`.
441
-
442
- Fixes #15994.
443
-
444
- *John Paul Ashenfelter*
268
+ * Encoding `ActiveSupport::TimeWithZone` to YAML now preserves the timezone information.
445
269
 
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.
270
+ Fixes #9183.
448
271
 
449
- *Sean Griffin*
272
+ *Andrew White*
450
273
 
451
- * Always instrument `ActiveSupport::Cache`.
274
+ * Added `ActiveSupport::TimeZone#strptime` to allow parsing times as if
275
+ from a given timezone.
452
276
 
453
- Since `ActiveSupport::Notifications` only instruments items when there
454
- are attached subscribers, we don't need to disable instrumentation.
277
+ *Paul A Jungwirth*
455
278
 
456
- *Peter Wagenet*
279
+ * `ActiveSupport::Callbacks#skip_callback` now raises an `ArgumentError` if
280
+ an unrecognized callback is removed.
457
281
 
458
- * Make the `apply_inflections` method case-insensitive when checking
459
- whether a word is uncountable or not.
282
+ *Iain Beeston*
460
283
 
461
- *Robin Dupret*
284
+ * Added `ActiveSupport::ArrayInquirer` and `Array#inquiry`.
462
285
 
463
- * Make Dependencies pass a name to NameError error.
286
+ Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
287
+ contents:
464
288
 
465
- *arthurnn*
289
+ variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
466
290
 
467
- * Fixed `ActiveSupport::Cache::FileStore` exploding with long paths.
291
+ variants.phone? # => true
292
+ variants.tablet? # => true
293
+ variants.desktop? # => false
468
294
 
469
- *Adam Panzer*, *Michael Grosser*
295
+ variants.any?(:phone, :tablet) # => true
296
+ variants.any?(:phone, :desktop) # => true
297
+ variants.any?(:desktop, :watch) # => false
470
298
 
471
- * Fixed `ActiveSupport::TimeWithZone#-` so precision is not unnecessarily lost
472
- when working with objects with a nanosecond component.
299
+ `Array#inquiry` is a shortcut for wrapping the receiving array in an
300
+ `ArrayInquirer`.
473
301
 
474
- `ActiveSupport::TimeWithZone#-` should return the same result as if we were
475
- using `Time#-`:
302
+ *George Claghorn*
476
303
 
477
- Time.now.end_of_day - Time.now.beginning_of_day # => 86399.999999999
304
+ * Deprecate `alias_method_chain` in favour of `Module#prepend` introduced in
305
+ Ruby 2.0.
478
306
 
479
- Before:
307
+ *Kir Shatrov*
480
308
 
481
- Time.zone.now.end_of_day.nsec # => 999999999
482
- Time.zone.now.end_of_day - Time.zone.now.beginning_of_day # => 86400.0
309
+ * Added `#without` on `Enumerable` and `Array` to return a copy of an
310
+ enumerable without the specified elements.
483
311
 
484
- After:
312
+ *Todd Bealmear*
485
313
 
486
- Time.zone.now.end_of_day - Time.zone.now.beginning_of_day
487
- # => 86399.999999999
314
+ * Fixed a problem where `String#truncate_words` would get stuck with a complex
315
+ string.
488
316
 
489
- *Gordon Chan*
317
+ *Henrik Nygren*
490
318
 
491
- * Fixed precision error in NumberHelper when using Rationals.
319
+ * Fixed a roundtrip problem with `AS::SafeBuffer` where primitive-like strings
320
+ will be dumped as primitives:
492
321
 
493
322
  Before:
494
323
 
495
- ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
496
- # => "330.00"
324
+ YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
325
+ YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true
326
+ YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false
327
+ YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
328
+ YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
497
329
 
498
330
  After:
499
331
 
500
- ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
501
- # => "333.33"
502
-
503
- See #15379.
504
-
505
- *Juanjo Bazán*
506
-
507
- * Removed deprecated `Numeric#ago` and friends
508
-
509
- Replacements:
510
-
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
515
-
516
- See #12389 for the history and rationale behind this.
332
+ YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
333
+ YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
334
+ YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
335
+ YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
336
+ YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
517
337
 
518
338
  *Godfrey Chan*
519
339
 
520
- * DateTime `advance` now supports partial days.
340
+ * Enable `number_to_percentage` to keep the number's precision by allowing
341
+ `:precision` to be `nil`.
521
342
 
522
- Before:
343
+ *Jack Xu*
523
344
 
524
- DateTime.now.advance(days: 1, hours: 12)
345
+ * `config_accessor` became a private method, as with Ruby's `attr_accessor`.
525
346
 
526
- After:
347
+ *Akira Matsuda*
527
348
 
528
- DateTime.now.advance(days: 1.5)
349
+ * `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
350
+ `Time.now` and `Date.today`.
529
351
 
530
- Fixes #12005.
352
+ *Yuki Nishijima*
531
353
 
532
- *Shay Davidson*
354
+ * Add `file_fixture` to `ActiveSupport::TestCase`.
355
+ It provides a simple mechanism to access sample files in your test cases.
533
356
 
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!`.
357
+ By default file fixtures are stored in `test/fixtures/files`. This can be
358
+ configured per test-case using the `file_fixture_path` class attribute.
538
359
 
539
- *OZAWA Sakuro*
360
+ *Yves Senn*
540
361
 
541
- * Fixed confusing `DelegationError` in `Module#delegate`.
362
+ * Return value of yielded block in `File.atomic_write`.
542
363
 
543
- See #15186.
364
+ *Ian Ker-Seymer*
544
365
 
545
- *Vladimir Yarotsky*
366
+ * Duplicate frozen array when assigning it to a `HashWithIndifferentAccess` so
367
+ that it doesn't raise a `RuntimeError` when calling `map!` on it in `convert_value`.
546
368
 
547
- * Fixed `ActiveSupport::Subscriber` so that no duplicate subscriber is created
548
- when a subscriber method is redefined.
369
+ Fixes #18550.
549
370
 
550
- *Dennis Schön*
371
+ *Aditya Kapoor*
551
372
 
552
- * Remove deprecated string based terminators for `ActiveSupport::Callbacks`.
373
+ * Add missing time zone definitions for Russian Federation and sync them
374
+ with `zone.tab` file from tzdata version 2014j (latest).
553
375
 
554
- *Eileen M. Uchitelle*
376
+ *Andrey Novikov*
555
377
 
556
- * Fixed an issue when using
557
- `ActiveSupport::NumberHelper::NumberToDelimitedConverter` to
558
- convert a value that is an `ActiveSupport::SafeBuffer` introduced
559
- in 2da9d67.
378
+ * Add `SecureRandom.base58` for generation of random base58 strings.
560
379
 
561
- See #15064.
380
+ *Matthew Draper*, *Guillermo Iguaran*
562
381
 
563
- *Mark J. Titorenko*
382
+ * Add `#prev_day` and `#next_day` counterparts to `#yesterday` and
383
+ `#tomorrow` for `Date`, `Time`, and `DateTime`.
564
384
 
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`.
385
+ *George Claghorn*
568
386
 
569
- *Ulysse Carion*
387
+ * Add `same_time` option to `#next_week` and `#prev_week` for `Date`, `Time`,
388
+ and `DateTime`.
570
389
 
571
- * `humanize` strips leading underscores, if any.
390
+ *George Claghorn*
572
391
 
573
- Before:
392
+ * Add `#on_weekend?`, `#next_weekday`, `#prev_weekday` methods to `Date`,
393
+ `Time`, and `DateTime`.
574
394
 
575
- '_id'.humanize # => ""
395
+ `#on_weekend?` returns `true` if the receiving date/time falls on a Saturday
396
+ or Sunday.
576
397
 
577
- After:
398
+ `#next_weekday` returns a new date/time representing the next day that does
399
+ not fall on a Saturday or Sunday.
578
400
 
579
- '_id'.humanize # => "Id"
401
+ `#prev_weekday` returns a new date/time representing the previous day that
402
+ does not fall on a Saturday or Sunday.
580
403
 
581
- *Xavier Noria*
404
+ *George Claghorn*
582
405
 
583
- * Fixed backward compatibility issues introduced in 326e652.
406
+ * Change the default test order from `:sorted` to `:random`.
584
407
 
585
- Empty Hash or Array should not be present in serialization result.
408
+ *Rafael Mendonça França*
586
409
 
587
- {a: []}.to_query # => ""
588
- {a: {}}.to_query # => ""
410
+ * Remove deprecated `ActiveSupport::JSON::Encoding::CircularReferenceError`.
589
411
 
590
- For more info see #14948.
412
+ *Rafael Mendonça França*
591
413
 
592
- *Bogdan Gusiev*
414
+ * Remove deprecated methods `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=`
415
+ and `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string`.
593
416
 
594
- * Add `Digest::UUID::uuid_v3` and `Digest::UUID::uuid_v5` to support stable
595
- UUID fixtures on PostgreSQL.
417
+ *Rafael Mendonça França*
596
418
 
597
- *Roderick van Domburg*
419
+ * Remove deprecated `ActiveSupport::SafeBuffer#prepend`.
598
420
 
599
- * Fixed `ActiveSupport::Duration#eql?` so that `1.second.eql?(1.second)` is
600
- true.
421
+ *Rafael Mendonça França*
601
422
 
602
- This fixes the current situation of:
423
+ * Remove deprecated methods at `Kernel`.
603
424
 
604
- 1.second.eql?(1.second) # => false
425
+ `silence_stderr`, `silence_stream`, `capture` and `quietly`.
605
426
 
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:
427
+ *Rafael Mendonça França*
609
428
 
610
- 1.eql?(1.0) # => false
611
- 1.0.eql?(1) # => false
429
+ * Remove deprecated `active_support/core_ext/big_decimal/yaml_conversions`
430
+ file.
612
431
 
613
- 1.second.eql?(1) # => false (was true)
614
- 1.eql?(1.second) # => false
432
+ *Rafael Mendonça França*
615
433
 
616
- { 1 => "foo", 1.0 => "bar" }
617
- # => { 1 => "foo", 1.0 => "bar" }
434
+ * Remove deprecated methods `ActiveSupport::Cache::Store.instrument` and
435
+ `ActiveSupport::Cache::Store.instrument=`.
618
436
 
619
- { 1 => "foo", 1.second => "bar" }
620
- # now => { 1 => "foo", 1.second => "bar" }
621
- # was => { 1 => "bar" }
437
+ *Rafael Mendonça França*
622
438
 
623
- And though the behavior of these hasn't changed, for reference:
439
+ * Change the way in which callback chains can be halted.
624
440
 
625
- 1 == 1.0 # => true
626
- 1.0 == 1 # => true
441
+ The preferred method to halt a callback chain from now on is to explicitly
442
+ `throw(:abort)`.
443
+ In the past, callbacks could only be halted by explicitly providing a
444
+ terminator and by having a callback match the conditions of the terminator.
627
445
 
628
- 1 == 1.second # => true
629
- 1.second == 1 # => true
446
+ * Add `ActiveSupport.halt_callback_chains_on_return_false`
630
447
 
631
- *Emily Dobervich*
448
+ Setting `ActiveSupport.halt_callback_chains_on_return_false`
449
+ to `true` will let an app support the deprecated way of halting Active Record,
450
+ and Active Model callback chains by returning `false`.
632
451
 
633
- * `ActiveSupport::SafeBuffer#prepend` acts like `String#prepend` and modifies
634
- instance in-place, returning self. `ActiveSupport::SafeBuffer#prepend!` is
635
- deprecated.
452
+ Setting the value to `false` will tell the app to ignore any `false` value
453
+ returned by those callbacks, and only halt the chain upon `throw(:abort)`.
636
454
 
637
- *Pavel Pravosud*
455
+ When the configuration option is missing, its value is `true`, so older apps
456
+ ported to Rails 5.0 will not break (but display a deprecation warning).
457
+ For new Rails 5.0 apps, its value is set to `false` in an initializer, so
458
+ these apps will support the new behavior by default.
638
459
 
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.
460
+ *claudiob*, *Roque Pinel*
643
461
 
644
- *Peter Jaros*
462
+ * Changes arguments and default value of CallbackChain's `:terminator` option
645
463
 
646
- * Deprecate `Class#superclass_delegating_accessor`, use `Class#class_attribute` instead.
464
+ Chains of callbacks defined without an explicit `:terminator` option will
465
+ now be halted as soon as a `before_` callback throws `:abort`.
647
466
 
648
- *Akshay Vishnoi*
467
+ Chains of callbacks defined with a `:terminator` option will maintain their
468
+ existing behavior of halting as soon as a `before_` callback matches the
469
+ terminator's expectation.
649
470
 
650
- * Ensure classes which `include Enumerable` get `#to_json` in addition to
651
- `#as_json`.
471
+ *claudiob*
652
472
 
653
- *Sammy Larbi*
473
+ * Deprecate `MissingSourceFile` in favor of `LoadError`.
654
474
 
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`.
475
+ `MissingSourceFile` was just an alias to `LoadError` and was not being
476
+ raised inside the framework.
657
477
 
658
- *Parker Selbert*
478
+ *Rafael Mendonça França*
659
479
 
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.
480
+ * Add support for error dispatcher classes in `ActiveSupport::Rescuable`.
481
+ Now it acts closer to Ruby's rescue.
663
482
 
664
- # app/models/concerns/authentication.rb
665
- concern :Authentication do
666
- included do
667
- after_create :generate_private_key
668
- end
483
+ Example:
669
484
 
670
- class_methods do
671
- def authenticate(credentials)
672
- # ...
485
+ class BaseController < ApplicationController
486
+ module ErrorDispatcher
487
+ def self.===(other)
488
+ Exception === other && other.respond_to?(:status)
673
489
  end
674
490
  end
675
491
 
676
- def generate_private_key
677
- # ...
492
+ rescue_from ErrorDispatcher do |error|
493
+ render status: error.status, json: { error: error.to_s }
678
494
  end
679
495
  end
680
496
 
681
- # app/models/user.rb
682
- class User < ActiveRecord::Base
683
- include Authentication
684
- end
497
+ *Genadi Samokovarov*
498
+
499
+ * Add `#verified` and `#valid_message?` methods to `ActiveSupport::MessageVerifier`
500
+
501
+ Previously, the only way to decode a message with `ActiveSupport::MessageVerifier`
502
+ was to use `#verify`, which would raise an exception on invalid messages. Now
503
+ `#verified` can also be used, which returns `nil` on messages that cannot be
504
+ decoded.
505
+
506
+ Previously, there was no way to check if a message's format was valid without
507
+ attempting to decode it. `#valid_message?` is a boolean convenience method that
508
+ checks whether the message is valid without actually decoding it.
685
509
 
686
- *Jeremy Kemper*
510
+ *Logan Leger*
687
511
 
688
- Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activesupport/CHANGELOG.md) for previous changes.
512
+ Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activesupport/CHANGELOG.md) for previous changes.