Skip to content

Commit 8808df6

Browse files
authored
Merge pull request rails#49624 from rails/rm-deprecations
Remove all deprecated code
2 parents 20444dd + b35df00 commit 8808df6

File tree

64 files changed

+355
-1621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+355
-1621
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ GEM
377377
path_expander (1.1.1)
378378
pg (1.5.4)
379379
prettier_print (1.2.1)
380-
prism (0.19.0)
380+
prism (0.27.0)
381381
propshaft (0.8.0)
382382
actionpack (>= 7.0.0)
383383
activesupport (>= 7.0.0)

activestorage/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
* Remove deprecated `config.active_storage.silence_invalid_content_types_warning`.
2+
3+
*Rafael Mendonça França*
4+
5+
* Remove deprecated `config.active_storage.replace_on_assign_to_many`.
6+
7+
*Rafael Mendonça França*
8+
19
* Add support for custom `key` in `ActiveStorage::Blob#compose`.
210

311
*Elvin Efendiev*

activestorage/lib/active_storage.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -365,22 +365,6 @@ module ActiveStorage
365365

366366
mattr_accessor :video_preview_arguments, default: "-y -vframes 1 -f image2"
367367

368-
def self.replace_on_assign_to_many
369-
ActiveStorage.deprecator.warn("config.active_storage.replace_on_assign_to_many is deprecated and has no effect.")
370-
end
371-
372-
def self.replace_on_assign_to_many=(value)
373-
ActiveStorage.deprecator.warn("config.active_storage.replace_on_assign_to_many is deprecated and has no effect.")
374-
end
375-
376-
def self.silence_invalid_content_types_warning
377-
ActiveStorage.deprecator.warn("config.active_storage.silence_invalid_content_types_warning is deprecated and has no effect.")
378-
end
379-
380-
def self.silence_invalid_content_types_warning=(value)
381-
ActiveStorage.deprecator.warn("config.active_storage.silence_invalid_content_types_warning is deprecated and has no effect.")
382-
end
383-
384368
module Transformers
385369
extend ActiveSupport::Autoload
386370

activesupport/CHANGELOG.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,64 @@
1+
* Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`.
2+
3+
*Rafael Mendonça França*
4+
5+
* Remove deprecated support to call the following methods without passing a deprecator:
6+
7+
- `deprecate`
8+
- `deprecate_constant`
9+
- `ActiveSupport::Deprecation::DeprecatedObjectProxy.new`
10+
- `ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new`
11+
- `ActiveSupport::Deprecation::DeprecatedConstantProxy.new`
12+
- `assert_deprecated`
13+
- `assert_not_deprecated`
14+
- `collect_deprecations`
15+
16+
*Rafael Mendonça França*
17+
18+
* Remove deprecated `ActiveSupport::Deprecation` delegation to instance.
19+
20+
*Rafael Mendonça França*
21+
22+
* Remove deprecated `SafeBuffer#clone_empty`.
23+
24+
*Rafael Mendonça França*
25+
26+
* Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.
27+
28+
*Rafael Mendonça França*
29+
30+
* Remove deprecated support to passing `Dalli::Client` instances to `MemCacheStore`.
31+
32+
*Rafael Mendonça França*
33+
34+
* Remove deprecated `config.active_support.use_rfc4122_namespaced_uuids`.
35+
36+
*Rafael Mendonça França*
37+
38+
* Remove deprecated `config.active_support.remove_deprecated_time_with_zone_name`.
39+
40+
*Rafael Mendonça França*
41+
42+
* Remove deprecated `config.active_support.disable_to_s_conversion`.
43+
44+
*Rafael Mendonça França*
45+
46+
* Remove deprecated support to bolding log text with positional boolean in `ActiveSupport::LogSubscriber#color`.
47+
48+
*Rafael Mendonça França*
49+
50+
* Remove deprecated constants `ActiveSupport::LogSubscriber::CLEAR` and `ActiveSupport::LogSubscriber::BOLD`.
51+
52+
*Rafael Mendonça França*
53+
54+
* Remove deprecated support for `config.active_support.cache_format_version = 6.1`.
55+
56+
*Rafael Mendonça França*
57+
58+
* Remove deprecated `:pool_size` and `:pool_timeout` options for the cache storage.
59+
60+
*Rafael Mendonça França*
61+
162
* Warn on tests without assertions.
263

364
`ActiveSupport::TestCase` now warns when tests do not run any assertions.
@@ -54,6 +115,18 @@
54115

55116
*Sean Doyle*
56117

118+
* Remove deprecated support for the pre-Ruby 2.4 behavior of `to_time` returning a `Time` object with local timezone.
119+
120+
*Rafael Mendonça França*
121+
122+
* Deprecate `config.active_support.to_time_preserves_timezone`.
123+
124+
*Rafael Mendonça França*
125+
126+
* Deprecate `DateAndTime::Compatibility.preserve_timezone`.
127+
128+
*Rafael Mendonça França*
129+
57130
* Yield instance to `Object#with` block
58131

59132
```ruby

activesupport/lib/active_support.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,15 @@ def self.cache_format_version=(value)
111111
end
112112

113113
def self.to_time_preserves_timezone
114-
DateAndTime::Compatibility.preserve_timezone
114+
ActiveSupport.deprecator.warn(
115+
"`config.active_support.to_time_preserves_timezone` has been deprecated and will be removed in Rails 7.3."
116+
)
115117
end
116118

117119
def self.to_time_preserves_timezone=(value)
118-
unless value
119-
ActiveSupport.deprecator.warn(
120-
"Support for the pre-Ruby 2.4 behavior of to_time has been deprecated and will be removed in Rails 7.2."
121-
)
122-
end
123-
124-
DateAndTime::Compatibility.preserve_timezone = value
120+
ActiveSupport.deprecator.warn(
121+
"`config.active_support.to_time_preserves_timezone` has been deprecated and will be removed in Rails 7.3."
122+
)
125123
end
126124

127125
def self.utc_to_local_returns_utc_offset_times

activesupport/lib/active_support/cache.rb

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ module Strategy
5252
autoload :LocalCache, "active_support/cache/strategy/local_cache"
5353
end
5454

55-
@format_version = 6.1
55+
@format_version = 7.0
5656

5757
class << self
5858
attr_accessor :format_version
@@ -200,24 +200,6 @@ class << self
200200
def retrieve_pool_options(options)
201201
if options.key?(:pool)
202202
pool_options = options.delete(:pool)
203-
elsif options.key?(:pool_size) || options.key?(:pool_timeout)
204-
pool_options = {}
205-
206-
if options.key?(:pool_size)
207-
ActiveSupport.deprecator.warn(<<~MSG)
208-
Using :pool_size is deprecated and will be removed in Rails 7.2.
209-
Use `pool: { size: #{options[:pool_size].inspect} }` instead.
210-
MSG
211-
pool_options[:size] = options.delete(:pool_size)
212-
end
213-
214-
if options.key?(:pool_timeout)
215-
ActiveSupport.deprecator.warn(<<~MSG)
216-
Using :pool_timeout is deprecated and will be removed in Rails 7.2.
217-
Use `pool: { timeout: #{options[:pool_timeout].inspect} }` instead.
218-
MSG
219-
pool_options[:timeout] = options.delete(:pool_timeout)
220-
end
221203
else
222204
pool_options = true
223205
end
@@ -779,14 +761,6 @@ def clear(options = nil)
779761
private
780762
def default_serializer
781763
case Cache.format_version
782-
when 6.1
783-
ActiveSupport.deprecator.warn <<~EOM
784-
Support for `config.active_support.cache_format_version = 6.1` has been deprecated and will be removed in Rails 7.2.
785-
786-
Check the Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-activesupport-cache-serialization-format
787-
for more information on how to upgrade.
788-
EOM
789-
Cache::SerializerWithFallback[:marshal_6_1]
790764
when 7.0
791765
Cache::SerializerWithFallback[:marshal_7_0]
792766
when 7.1

activesupport/lib/active_support/cache/mem_cache_store.rb

Lines changed: 6 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -41,46 +41,6 @@ def self.supports_cache_versioning?
4141

4242
prepend Strategy::LocalCache
4343

44-
module DupLocalCache
45-
class DupLocalStore < DelegateClass(Strategy::LocalCache::LocalStore)
46-
def write_entry(_key, entry)
47-
if entry.is_a?(Entry)
48-
entry.dup_value!
49-
end
50-
super
51-
end
52-
53-
def fetch_entry(key)
54-
entry = super do
55-
new_entry = yield
56-
if entry.is_a?(Entry)
57-
new_entry.dup_value!
58-
end
59-
new_entry
60-
end
61-
entry = entry.dup
62-
63-
if entry.is_a?(Entry)
64-
entry.dup_value!
65-
end
66-
67-
entry
68-
end
69-
end
70-
71-
private
72-
def local_cache
73-
if ActiveSupport::Cache.format_version == 6.1
74-
if local_cache = super
75-
DupLocalStore.new(local_cache)
76-
end
77-
else
78-
super
79-
end
80-
end
81-
end
82-
prepend DupLocalCache
83-
8444
KEY_MAX_SIZE = 250
8545
ESCAPE_KEY_CHARS = /[\x00-\x20%\x7F-\xFF]/n
8646

@@ -114,7 +74,6 @@ def self.build_mem_cache(*addresses) # :nodoc:
11474
#
11575
# If no addresses are provided, but <tt>ENV['MEMCACHE_SERVERS']</tt> is defined, it will be used instead. Otherwise,
11676
# +MemCacheStore+ will connect to localhost:11211 (the default memcached port).
117-
# Passing a +Dalli::Client+ instance is deprecated and will be removed. Please pass an address instead.
11877
def initialize(*addresses)
11978
addresses = addresses.flatten
12079
options = addresses.extract_options!
@@ -126,19 +85,12 @@ def initialize(*addresses)
12685
unless [String, Dalli::Client, NilClass].include?(addresses.first.class)
12786
raise ArgumentError, "First argument must be an empty array, address, or array of addresses."
12887
end
129-
if addresses.first.is_a?(Dalli::Client)
130-
ActiveSupport.deprecator.warn(<<~MSG)
131-
Initializing MemCacheStore with a Dalli::Client is deprecated and will be removed in Rails 7.2.
132-
Use memcached server addresses instead.
133-
MSG
134-
@data = addresses.first
135-
else
136-
@mem_cache_options = options.dup
137-
# The value "compress: false" prevents duplicate compression within Dalli.
138-
@mem_cache_options[:compress] = false
139-
(OVERRIDDEN_OPTIONS - %i(compress)).each { |name| @mem_cache_options.delete(name) }
140-
@data = self.class.build_mem_cache(*(addresses + [@mem_cache_options]))
141-
end
88+
89+
@mem_cache_options = options.dup
90+
# The value "compress: false" prevents duplicate compression within Dalli.
91+
@mem_cache_options[:compress] = false
92+
(OVERRIDDEN_OPTIONS - %i(compress)).each { |name| @mem_cache_options.delete(name) }
93+
@data = self.class.build_mem_cache(*(addresses + [@mem_cache_options]))
14294
end
14395

14496
def inspect
@@ -226,20 +178,6 @@ def stats
226178
end
227179

228180
private
229-
def default_serializer
230-
if Cache.format_version == 6.1
231-
ActiveSupport.deprecator.warn <<~EOM
232-
Support for `config.active_support.cache_format_version = 6.1` has been deprecated and will be removed in Rails 7.2.
233-
234-
Check the Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-activesupport-cache-serialization-format
235-
for more information on how to upgrade.
236-
EOM
237-
Cache::SerializerWithFallback[:passthrough]
238-
else
239-
super
240-
end
241-
end
242-
243181
# Read an entry from the cache.
244182
def read_entry(key, **options)
245183
deserialize_entry(read_serialized_entry(key, **options), **options)

activesupport/lib/active_support/cache/serializer_with_fallback.rb

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,6 @@ def dumped?(dumped)
6363
end
6464
end
6565

66-
module Marshal61WithFallback
67-
include SerializerWithFallback
68-
extend self
69-
70-
MARSHAL_SIGNATURE = "\x04\x08".b.freeze
71-
72-
def dump(entry)
73-
Marshal.dump(entry)
74-
end
75-
76-
def dump_compressed(entry, threshold)
77-
Marshal.dump(entry.compressed(threshold))
78-
end
79-
80-
alias_method :_load, :marshal_load
81-
public :_load
82-
83-
def dumped?(dumped)
84-
dumped.start_with?(MARSHAL_SIGNATURE)
85-
end
86-
end
87-
8866
module Marshal70WithFallback
8967
include SerializerWithFallback
9068
extend self
@@ -165,7 +143,6 @@ def available?
165143

166144
SERIALIZERS = {
167145
passthrough: PassthroughWithFallback,
168-
marshal_6_1: Marshal61WithFallback,
169146
marshal_7_0: Marshal70WithFallback,
170147
marshal_7_1: Marshal71WithFallback,
171148
message_pack: MessagePackWithFallback,

activesupport/lib/active_support/core_ext/array/conversions.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ def to_fs(format = :default)
104104
end
105105
end
106106
alias_method :to_formatted_s, :to_fs
107-
alias_method :to_default_s, :to_s
108-
deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator
109107

110108
# Returns a string that represents the array in XML by invoking +to_xml+
111109
# on each element. Active Record collections delegate their representation

activesupport/lib/active_support/core_ext/date/conversions.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ def to_fs(format = :default)
5656
end
5757
end
5858
alias_method :to_formatted_s, :to_fs
59-
alias_method :to_default_s, :to_s
60-
deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator
6159

6260
# Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005"
6361
def readable_inspect

0 commit comments

Comments
 (0)