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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +309 -485
- data/MIT-LICENSE +1 -1
- data/README.rdoc +2 -3
- data/lib/active_support.rb +8 -15
- data/lib/active_support/array_inquirer.rb +44 -0
- data/lib/active_support/backtrace_cleaner.rb +1 -1
- data/lib/active_support/cache.rb +59 -72
- data/lib/active_support/cache/file_store.rb +27 -19
- data/lib/active_support/cache/mem_cache_store.rb +71 -60
- data/lib/active_support/cache/memory_store.rb +16 -21
- data/lib/active_support/cache/null_store.rb +1 -4
- data/lib/active_support/cache/strategy/local_cache.rb +31 -20
- data/lib/active_support/callbacks.rb +107 -111
- data/lib/active_support/concern.rb +1 -1
- data/lib/active_support/concurrency/latch.rb +7 -15
- data/lib/active_support/concurrency/share_lock.rb +142 -0
- data/lib/active_support/configurable.rb +1 -0
- data/lib/active_support/core_ext.rb +2 -1
- data/lib/active_support/core_ext/array.rb +1 -0
- data/lib/active_support/core_ext/array/access.rb +13 -1
- data/lib/active_support/core_ext/array/conversions.rb +6 -4
- data/lib/active_support/core_ext/array/inquiry.rb +17 -0
- data/lib/active_support/core_ext/array/wrap.rb +5 -4
- data/lib/active_support/core_ext/big_decimal/conversions.rb +8 -10
- data/lib/active_support/core_ext/class.rb +0 -1
- data/lib/active_support/core_ext/class/attribute.rb +10 -9
- data/lib/active_support/core_ext/class/subclasses.rb +5 -2
- data/lib/active_support/core_ext/date.rb +1 -1
- data/lib/active_support/core_ext/date/blank.rb +12 -0
- data/lib/active_support/core_ext/date/calculations.rb +1 -1
- data/lib/active_support/core_ext/date/conversions.rb +3 -3
- data/lib/active_support/core_ext/date_and_time/calculations.rb +93 -27
- data/lib/active_support/core_ext/date_and_time/zones.rb +1 -2
- data/lib/active_support/core_ext/date_time.rb +1 -1
- data/lib/active_support/core_ext/date_time/blank.rb +12 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +7 -23
- data/lib/active_support/core_ext/date_time/conversions.rb +2 -0
- data/lib/active_support/core_ext/enumerable.rb +27 -17
- data/lib/active_support/core_ext/file/atomic.rb +30 -25
- data/lib/active_support/core_ext/hash/compact.rb +15 -19
- data/lib/active_support/core_ext/hash/conversions.rb +21 -2
- data/lib/active_support/core_ext/hash/deep_merge.rb +1 -1
- data/lib/active_support/core_ext/hash/except.rb +9 -8
- data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -1
- data/lib/active_support/core_ext/hash/keys.rb +22 -18
- data/lib/active_support/core_ext/hash/slice.rb +1 -1
- data/lib/active_support/core_ext/hash/transform_values.rb +13 -7
- data/lib/active_support/core_ext/integer/time.rb +1 -1
- data/lib/active_support/core_ext/kernel.rb +0 -1
- data/lib/active_support/core_ext/kernel/debugger.rb +3 -10
- data/lib/active_support/core_ext/kernel/reporting.rb +0 -84
- data/lib/active_support/core_ext/load_error.rb +4 -2
- data/lib/active_support/core_ext/marshal.rb +8 -13
- data/lib/active_support/core_ext/module.rb +1 -0
- data/lib/active_support/core_ext/module/aliasing.rb +6 -1
- data/lib/active_support/core_ext/module/anonymous.rb +10 -1
- data/lib/active_support/core_ext/module/attr_internal.rb +2 -5
- data/lib/active_support/core_ext/module/attribute_accessors.rb +7 -7
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +141 -0
- data/lib/active_support/core_ext/module/concerning.rb +4 -4
- data/lib/active_support/core_ext/module/delegation.rb +7 -14
- data/lib/active_support/core_ext/module/method_transplanting.rb +3 -13
- data/lib/active_support/core_ext/module/qualified_const.rb +30 -12
- data/lib/active_support/core_ext/module/remove_method.rb +23 -0
- data/lib/active_support/core_ext/name_error.rb +15 -2
- data/lib/active_support/core_ext/numeric.rb +1 -0
- data/lib/active_support/core_ext/numeric/bytes.rb +20 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +12 -23
- data/lib/active_support/core_ext/numeric/inquiry.rb +26 -0
- data/lib/active_support/core_ext/numeric/time.rb +20 -0
- data/lib/active_support/core_ext/object.rb +0 -1
- data/lib/active_support/core_ext/object/blank.rb +11 -2
- data/lib/active_support/core_ext/object/deep_dup.rb +10 -3
- data/lib/active_support/core_ext/object/duplicable.rb +39 -70
- data/lib/active_support/core_ext/object/inclusion.rb +2 -2
- data/lib/active_support/core_ext/object/instance_variables.rb +1 -1
- data/lib/active_support/core_ext/object/json.rb +9 -7
- data/lib/active_support/core_ext/object/to_query.rb +1 -1
- data/lib/active_support/core_ext/object/try.rb +67 -21
- data/lib/active_support/core_ext/object/with_options.rb +1 -1
- data/lib/active_support/core_ext/range/conversions.rb +18 -6
- data/lib/active_support/core_ext/range/each.rb +16 -18
- data/lib/active_support/core_ext/range/include_range.rb +20 -20
- data/lib/active_support/core_ext/securerandom.rb +23 -0
- data/lib/active_support/core_ext/string/access.rb +1 -1
- data/lib/active_support/core_ext/string/behavior.rb +1 -1
- data/lib/active_support/core_ext/string/conversions.rb +2 -2
- data/lib/active_support/core_ext/string/filters.rb +1 -2
- data/lib/active_support/core_ext/string/inflections.rb +23 -5
- data/lib/active_support/core_ext/string/multibyte.rb +11 -7
- data/lib/active_support/core_ext/string/output_safety.rb +8 -9
- data/lib/active_support/core_ext/string/strip.rb +3 -6
- data/lib/active_support/core_ext/struct.rb +3 -6
- data/lib/active_support/core_ext/time.rb +0 -2
- data/lib/active_support/core_ext/time/calculations.rb +18 -16
- data/lib/active_support/core_ext/time/conversions.rb +4 -2
- data/lib/active_support/core_ext/time/marshal.rb +2 -29
- data/lib/active_support/core_ext/time/zones.rb +19 -3
- data/lib/active_support/core_ext/uri.rb +1 -3
- data/lib/active_support/dependencies.rb +79 -44
- data/lib/active_support/dependencies/interlock.rb +47 -0
- data/lib/active_support/deprecation/behaviors.rb +12 -0
- data/lib/active_support/deprecation/method_wrappers.rb +42 -16
- data/lib/active_support/deprecation/proxy_wrappers.rb +47 -24
- data/lib/active_support/deprecation/reporting.rb +13 -2
- data/lib/active_support/duration.rb +5 -8
- data/lib/active_support/evented_file_update_checker.rb +150 -0
- data/lib/active_support/file_update_checker.rb +1 -1
- data/lib/active_support/gem_version.rb +5 -5
- data/lib/active_support/hash_with_indifferent_access.rb +15 -17
- data/lib/active_support/i18n_railtie.rb +25 -4
- data/lib/active_support/inflector/inflections.rb +36 -5
- data/lib/active_support/inflector/methods.rb +87 -89
- data/lib/active_support/inflector/transliterate.rb +36 -21
- data/lib/active_support/json/decoding.rb +2 -8
- data/lib/active_support/json/encoding.rb +0 -50
- data/lib/active_support/key_generator.rb +4 -4
- data/lib/active_support/log_subscriber.rb +1 -1
- data/lib/active_support/log_subscriber/test_helper.rb +3 -3
- data/lib/active_support/logger.rb +4 -52
- data/lib/active_support/logger_silence.rb +3 -5
- data/lib/active_support/message_encryptor.rb +4 -11
- data/lib/active_support/message_verifier.rb +64 -8
- data/lib/active_support/multibyte/chars.rb +12 -3
- data/lib/active_support/multibyte/unicode.rb +6 -8
- data/lib/active_support/notifications.rb +2 -2
- data/lib/active_support/notifications/fanout.rb +5 -5
- data/lib/active_support/notifications/instrumenter.rb +19 -2
- data/lib/active_support/number_helper.rb +21 -15
- data/lib/active_support/number_helper/number_to_currency_converter.rb +4 -4
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +7 -2
- data/lib/active_support/number_helper/number_to_human_converter.rb +6 -4
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +5 -1
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +28 -25
- data/lib/active_support/ordered_options.rb +15 -1
- data/lib/active_support/per_thread_registry.rb +3 -0
- data/lib/active_support/rails.rb +2 -2
- data/lib/active_support/railtie.rb +6 -1
- data/lib/active_support/rescuable.rb +4 -4
- data/lib/active_support/security_utils.rb +0 -7
- data/lib/active_support/string_inquirer.rb +1 -1
- data/lib/active_support/subscriber.rb +5 -10
- data/lib/active_support/tagged_logging.rb +3 -1
- data/lib/active_support/test_case.rb +13 -25
- data/lib/active_support/testing/assertions.rb +15 -13
- data/lib/active_support/testing/autorun.rb +8 -1
- data/lib/active_support/testing/composite_filter.rb +54 -0
- data/lib/active_support/testing/deprecation.rb +9 -8
- data/lib/active_support/testing/file_fixtures.rb +34 -0
- data/lib/active_support/testing/isolation.rb +22 -8
- data/lib/active_support/testing/method_call_assertions.rb +41 -0
- data/lib/active_support/testing/stream.rb +42 -0
- data/lib/active_support/testing/time_helpers.rb +6 -6
- data/lib/active_support/time_with_zone.rb +135 -53
- data/lib/active_support/values/time_zone.rb +80 -46
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/xml_mini.rb +15 -30
- data/lib/active_support/xml_mini/jdom.rb +1 -1
- data/lib/active_support/xml_mini/libxml.rb +5 -3
- data/lib/active_support/xml_mini/libxmlsax.rb +4 -1
- data/lib/active_support/xml_mini/nokogiri.rb +5 -3
- data/lib/active_support/xml_mini/nokogirisax.rb +3 -1
- data/lib/active_support/xml_mini/rexml.rb +3 -1
- metadata +57 -21
- data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +0 -16
- data/lib/active_support/core_ext/class/delegating_attributes.rb +0 -45
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +0 -15
- data/lib/active_support/core_ext/date_time/compatibility.rb +0 -16
- data/lib/active_support/core_ext/object/itself.rb +0 -15
- data/lib/active_support/core_ext/thread.rb +0 -86
- data/lib/active_support/core_ext/time/compatibility.rb +0 -14
- data/lib/active_support/logger_thread_safe_level.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 25266c8f8202c7032187cc3b6cf443cb24a2d552
|
4
|
+
data.tar.gz: 6e9e0a596447ba31f6e55400dba1efece7b0ace2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3091306ea5f246815b8e76cb6800daea7c84cf8f920f1ef5367e172efc81a7384e702c02d1e7907d96bdbaa17ec9be7fb88e07903b862a8e286e1f051a4ea260
|
7
|
+
data.tar.gz: ebd7095f3ef49c3e175fd7fb04b6070d4fe7dd4aaecc837475e3808c75e6bfc94e0ed620df673e25d497cc1ba855a81dd1053f7764c1fad885f861e976534e16
|
data/CHANGELOG.md
CHANGED
@@ -1,204 +1,194 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 5.0.0.beta1 (December 18, 2015) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
47
|
+
class Event < ApplicationRecord
|
48
|
+
belongs_to :creator, class_name: 'User'
|
49
|
+
before_validation { self.creator ||= Current.user }
|
50
|
+
end
|
53
51
|
|
54
|
-
*
|
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
|
-
|
55
|
+
* Deprecated `Module#qualified_const_` in favour of the builtin Module#const_
|
56
|
+
methods.
|
60
57
|
|
58
|
+
*Genadi Samokovarov*
|
61
59
|
|
62
|
-
|
60
|
+
* Deprecate passing string to define callback.
|
63
61
|
|
64
|
-
*
|
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
|
-
|
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
|
-
|
69
|
+
`ActiveSupport::Cache::LocaleCache#set_cache_value` is deprecated and replaced with `write_cache_value`.
|
77
70
|
|
78
|
-
*
|
71
|
+
*Michael Grosser*
|
79
72
|
|
80
|
-
*
|
81
|
-
|
73
|
+
* Implements an evented file watcher to asynchronously detect changes in the
|
74
|
+
application source code, routes, locales, etc.
|
82
75
|
|
83
|
-
|
76
|
+
This watcher is disabled by default, applications my enable it in the configuration:
|
84
77
|
|
85
|
-
|
86
|
-
|
78
|
+
# config/environments/development.rb
|
79
|
+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
87
80
|
|
88
|
-
|
81
|
+
This feature depends on the [listen](https://github.com/guard/listen) gem:
|
89
82
|
|
90
|
-
|
83
|
+
group :development do
|
84
|
+
gem 'listen', '~> 3.0.5'
|
85
|
+
end
|
91
86
|
|
92
|
-
*
|
87
|
+
*Puneet Agarwal* and *Xavier Noria*
|
93
88
|
|
94
|
-
*
|
95
|
-
|
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
|
-
|
92
|
+
*Jon Pascoe*
|
101
93
|
|
102
|
-
|
103
|
-
=> "2016-04-23T06:23:12.000-04:00"
|
94
|
+
* Updated `parameterize` to preserve the case of a string, optionally.
|
104
95
|
|
105
|
-
|
96
|
+
Example:
|
106
97
|
|
107
|
-
|
108
|
-
=> "
|
98
|
+
parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth"
|
99
|
+
parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
|
109
100
|
|
110
|
-
|
101
|
+
*Swaathi Kakarla*
|
111
102
|
|
112
|
-
|
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
|
-
*
|
107
|
+
*Gordon Chan*
|
115
108
|
|
116
|
-
|
117
|
-
|
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
|
-
|
121
|
-
|
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
|
-
|
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
|
-
|
117
|
+
1.year # => 31557600.0
|
133
118
|
|
134
|
-
|
119
|
+
After:
|
135
120
|
|
136
|
-
|
121
|
+
1.year # => 31557600
|
137
122
|
|
138
|
-
|
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
|
-
|
125
|
+
* Handle invalid UTF-8 strings when HTML escaping
|
144
126
|
|
145
|
-
|
146
|
-
|
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
|
-
|
149
|
-
# => Sun, 06 Nov 2016 01:00:00 EST -05:00
|
132
|
+
*Grey Baker*
|
150
133
|
|
151
|
-
|
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
|
-
*
|
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
|
-
|
142
|
+
*Max Jacobson*
|
157
143
|
|
158
|
-
*
|
159
|
-
|
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
|
-
*
|
147
|
+
*Brandon Dunne*
|
163
148
|
|
164
|
-
*
|
165
|
-
`Rails.logger.level` is now thread safe.
|
149
|
+
* `Cache#fetch` instrumentation marks whether it was a `:hit`.
|
166
150
|
|
167
|
-
*
|
151
|
+
*Robin Clowers*
|
168
152
|
|
169
|
-
*
|
170
|
-
|
153
|
+
* `assert_difference` and `assert_no_difference` now returns the result of the
|
154
|
+
yielded block.
|
171
155
|
|
172
|
-
|
156
|
+
Example:
|
173
157
|
|
174
|
-
|
175
|
-
|
176
|
-
|
158
|
+
post = assert_difference -> { Post.count }, 1 do
|
159
|
+
Post.create
|
160
|
+
end
|
177
161
|
|
178
|
-
*
|
162
|
+
*Lucas Mazza*
|
179
163
|
|
180
|
-
*
|
181
|
-
which resolves to a different name.
|
164
|
+
* Short-circuit `blank?` on date and time values since they are never blank.
|
182
165
|
|
183
|
-
|
166
|
+
Fixes #21657
|
184
167
|
|
168
|
+
*Andrew White*
|
185
169
|
|
186
|
-
|
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
|
-
*
|
173
|
+
*Jerry D'Antonio*
|
189
174
|
|
175
|
+
* Updated Unicode version to 8.0.0
|
190
176
|
|
191
|
-
|
177
|
+
*Anshul Sharma*
|
192
178
|
|
193
|
-
*
|
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
|
-
|
184
|
+
number_to_currency(1230000, delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/, unit: '₹', format: "%u %n")
|
185
|
+
# => '₹ 12,30,000.00'
|
197
186
|
|
198
|
-
*
|
187
|
+
*Vipul A M*
|
199
188
|
|
189
|
+
* Deprecate `:prefix` option of `number_to_human_size` with no replacement.
|
200
190
|
|
201
|
-
|
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
|
-
*
|
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
|
-
|
206
|
+
*Bernard Potocki*
|
217
207
|
|
218
|
-
*
|
219
|
-
|
208
|
+
* Removed `ActiveSupport::Concurrency::Latch`, superseded by `Concurrent::CountDownLatch`
|
209
|
+
from the concurrent-ruby gem.
|
220
210
|
|
221
|
-
|
211
|
+
*Jerry D'Antonio*
|
222
212
|
|
223
|
-
|
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
|
226
|
+
* Add `Enumerable#pluck` to get the same values from arrays as from ActiveRecord
|
227
|
+
associations.
|
242
228
|
|
243
|
-
|
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
|
-
*
|
264
|
-
string.
|
265
|
-
|
266
|
-
*Henrik Nygren*
|
231
|
+
*Kevin Deisz*
|
267
232
|
|
268
|
-
*
|
269
|
-
|
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
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
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
|
-
|
244
|
+
After:
|
388
245
|
|
389
|
-
|
246
|
+
slack_url = Rails.application.secrets.slack_url!
|
390
247
|
|
391
|
-
*
|
392
|
-
value with the class itself since it was previously delegated to the
|
393
|
-
internal value.
|
248
|
+
*Aditya Sanghi*, *Gaurish Sharma*
|
394
249
|
|
395
|
-
|
250
|
+
* Remove deprecated `Class#superclass_delegating_accessor`.
|
251
|
+
Use `Class#class_attribute` instead.
|
396
252
|
|
397
|
-
*
|
398
|
-
with per-second precision, not anything deeper than that.
|
253
|
+
*Akshay Vishnoi*
|
399
254
|
|
400
|
-
|
255
|
+
* Patch `Delegator` to work with `#try`.
|
401
256
|
|
402
|
-
|
257
|
+
Fixes #5790.
|
403
258
|
|
404
|
-
*
|
259
|
+
*Nate Smith*
|
405
260
|
|
406
|
-
*
|
261
|
+
* Add `Integer#positive?` and `Integer#negative?` query methods
|
262
|
+
in the vein of `Fixnum#zero?`.
|
407
263
|
|
408
|
-
|
264
|
+
This makes it nicer to do things like `bunch_of_numbers.select(&:positive?)`.
|
409
265
|
|
410
266
|
*DHH*
|
411
267
|
|
412
|
-
* `
|
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
|
-
|
447
|
-
hash must change, but the keys are left the same.
|
270
|
+
Fixes #9183.
|
448
271
|
|
449
|
-
*
|
272
|
+
*Andrew White*
|
450
273
|
|
451
|
-
*
|
274
|
+
* Added `ActiveSupport::TimeZone#strptime` to allow parsing times as if
|
275
|
+
from a given timezone.
|
452
276
|
|
453
|
-
|
454
|
-
are attached subscribers, we don't need to disable instrumentation.
|
277
|
+
*Paul A Jungwirth*
|
455
278
|
|
456
|
-
|
279
|
+
* `ActiveSupport::Callbacks#skip_callback` now raises an `ArgumentError` if
|
280
|
+
an unrecognized callback is removed.
|
457
281
|
|
458
|
-
*
|
459
|
-
whether a word is uncountable or not.
|
282
|
+
*Iain Beeston*
|
460
283
|
|
461
|
-
|
284
|
+
* Added `ActiveSupport::ArrayInquirer` and `Array#inquiry`.
|
462
285
|
|
463
|
-
|
286
|
+
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
|
287
|
+
contents:
|
464
288
|
|
465
|
-
|
289
|
+
variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
|
466
290
|
|
467
|
-
|
291
|
+
variants.phone? # => true
|
292
|
+
variants.tablet? # => true
|
293
|
+
variants.desktop? # => false
|
468
294
|
|
469
|
-
|
295
|
+
variants.any?(:phone, :tablet) # => true
|
296
|
+
variants.any?(:phone, :desktop) # => true
|
297
|
+
variants.any?(:desktop, :watch) # => false
|
470
298
|
|
471
|
-
|
472
|
-
|
299
|
+
`Array#inquiry` is a shortcut for wrapping the receiving array in an
|
300
|
+
`ArrayInquirer`.
|
473
301
|
|
474
|
-
|
475
|
-
using `Time#-`:
|
302
|
+
*George Claghorn*
|
476
303
|
|
477
|
-
|
304
|
+
* Deprecate `alias_method_chain` in favour of `Module#prepend` introduced in
|
305
|
+
Ruby 2.0.
|
478
306
|
|
479
|
-
|
307
|
+
*Kir Shatrov*
|
480
308
|
|
481
|
-
|
482
|
-
|
309
|
+
* Added `#without` on `Enumerable` and `Array` to return a copy of an
|
310
|
+
enumerable without the specified elements.
|
483
311
|
|
484
|
-
|
312
|
+
*Todd Bealmear*
|
485
313
|
|
486
|
-
|
487
|
-
|
314
|
+
* Fixed a problem where `String#truncate_words` would get stuck with a complex
|
315
|
+
string.
|
488
316
|
|
489
|
-
*
|
317
|
+
*Henrik Nygren*
|
490
318
|
|
491
|
-
* Fixed
|
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::
|
496
|
-
# =>
|
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::
|
501
|
-
# => "
|
502
|
-
|
503
|
-
|
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
|
-
*
|
340
|
+
* Enable `number_to_percentage` to keep the number's precision by allowing
|
341
|
+
`:precision` to be `nil`.
|
521
342
|
|
522
|
-
|
343
|
+
*Jack Xu*
|
523
344
|
|
524
|
-
|
345
|
+
* `config_accessor` became a private method, as with Ruby's `attr_accessor`.
|
525
346
|
|
526
|
-
|
347
|
+
*Akira Matsuda*
|
527
348
|
|
528
|
-
|
349
|
+
* `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
|
350
|
+
`Time.now` and `Date.today`.
|
529
351
|
|
530
|
-
|
352
|
+
*Yuki Nishijima*
|
531
353
|
|
532
|
-
|
354
|
+
* Add `file_fixture` to `ActiveSupport::TestCase`.
|
355
|
+
It provides a simple mechanism to access sample files in your test cases.
|
533
356
|
|
534
|
-
|
535
|
-
|
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
|
-
*
|
360
|
+
*Yves Senn*
|
540
361
|
|
541
|
-
*
|
362
|
+
* Return value of yielded block in `File.atomic_write`.
|
542
363
|
|
543
|
-
|
364
|
+
*Ian Ker-Seymer*
|
544
365
|
|
545
|
-
|
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
|
-
|
548
|
-
when a subscriber method is redefined.
|
369
|
+
Fixes #18550.
|
549
370
|
|
550
|
-
*
|
371
|
+
*Aditya Kapoor*
|
551
372
|
|
552
|
-
*
|
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
|
-
*
|
376
|
+
*Andrey Novikov*
|
555
377
|
|
556
|
-
*
|
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
|
-
|
380
|
+
*Matthew Draper*, *Guillermo Iguaran*
|
562
381
|
|
563
|
-
|
382
|
+
* Add `#prev_day` and `#next_day` counterparts to `#yesterday` and
|
383
|
+
`#tomorrow` for `Date`, `Time`, and `DateTime`.
|
564
384
|
|
565
|
-
*
|
566
|
-
components are specified. This is more consistent with the behavior of
|
567
|
-
`Time#parse`.
|
385
|
+
*George Claghorn*
|
568
386
|
|
569
|
-
|
387
|
+
* Add `same_time` option to `#next_week` and `#prev_week` for `Date`, `Time`,
|
388
|
+
and `DateTime`.
|
570
389
|
|
571
|
-
*
|
390
|
+
*George Claghorn*
|
572
391
|
|
573
|
-
|
392
|
+
* Add `#on_weekend?`, `#next_weekday`, `#prev_weekday` methods to `Date`,
|
393
|
+
`Time`, and `DateTime`.
|
574
394
|
|
575
|
-
|
395
|
+
`#on_weekend?` returns `true` if the receiving date/time falls on a Saturday
|
396
|
+
or Sunday.
|
576
397
|
|
577
|
-
|
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
|
-
|
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
|
-
*
|
404
|
+
*George Claghorn*
|
582
405
|
|
583
|
-
*
|
406
|
+
* Change the default test order from `:sorted` to `:random`.
|
584
407
|
|
585
|
-
|
408
|
+
*Rafael Mendonça França*
|
586
409
|
|
587
|
-
|
588
|
-
{a: {}}.to_query # => ""
|
410
|
+
* Remove deprecated `ActiveSupport::JSON::Encoding::CircularReferenceError`.
|
589
411
|
|
590
|
-
|
412
|
+
*Rafael Mendonça França*
|
591
413
|
|
592
|
-
|
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
|
-
*
|
595
|
-
UUID fixtures on PostgreSQL.
|
417
|
+
*Rafael Mendonça França*
|
596
418
|
|
597
|
-
|
419
|
+
* Remove deprecated `ActiveSupport::SafeBuffer#prepend`.
|
598
420
|
|
599
|
-
*
|
600
|
-
true.
|
421
|
+
*Rafael Mendonça França*
|
601
422
|
|
602
|
-
|
423
|
+
* Remove deprecated methods at `Kernel`.
|
603
424
|
|
604
|
-
|
425
|
+
`silence_stderr`, `silence_stream`, `capture` and `quietly`.
|
605
426
|
|
606
|
-
|
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
|
-
|
611
|
-
|
429
|
+
* Remove deprecated `active_support/core_ext/big_decimal/yaml_conversions`
|
430
|
+
file.
|
612
431
|
|
613
|
-
|
614
|
-
1.eql?(1.second) # => false
|
432
|
+
*Rafael Mendonça França*
|
615
433
|
|
616
|
-
|
617
|
-
|
434
|
+
* Remove deprecated methods `ActiveSupport::Cache::Store.instrument` and
|
435
|
+
`ActiveSupport::Cache::Store.instrument=`.
|
618
436
|
|
619
|
-
|
620
|
-
# now => { 1 => "foo", 1.second => "bar" }
|
621
|
-
# was => { 1 => "bar" }
|
437
|
+
*Rafael Mendonça França*
|
622
438
|
|
623
|
-
|
439
|
+
* Change the way in which callback chains can be halted.
|
624
440
|
|
625
|
-
|
626
|
-
|
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
|
-
|
629
|
-
1.second == 1 # => true
|
446
|
+
* Add `ActiveSupport.halt_callback_chains_on_return_false`
|
630
447
|
|
631
|
-
|
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
|
-
|
634
|
-
|
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
|
-
|
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
|
-
*
|
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
|
-
|
462
|
+
* Changes arguments and default value of CallbackChain's `:terminator` option
|
645
463
|
|
646
|
-
|
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
|
-
|
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
|
-
*
|
651
|
-
`#as_json`.
|
471
|
+
*claudiob*
|
652
472
|
|
653
|
-
|
473
|
+
* Deprecate `MissingSourceFile` in favor of `LoadError`.
|
654
474
|
|
655
|
-
|
656
|
-
|
475
|
+
`MissingSourceFile` was just an alias to `LoadError` and was not being
|
476
|
+
raised inside the framework.
|
657
477
|
|
658
|
-
*
|
478
|
+
*Rafael Mendonça França*
|
659
479
|
|
660
|
-
*
|
661
|
-
|
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
|
-
|
665
|
-
concern :Authentication do
|
666
|
-
included do
|
667
|
-
after_create :generate_private_key
|
668
|
-
end
|
483
|
+
Example:
|
669
484
|
|
670
|
-
|
671
|
-
|
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
|
-
|
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
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
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
|
-
*
|
510
|
+
*Logan Leger*
|
687
511
|
|
688
|
-
Please check [4-
|
512
|
+
Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activesupport/CHANGELOG.md) for previous changes.
|