Skip to content

Commit c8019c0

Browse files
committed
Remove deprecated ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=
1 parent e1c8b9f commit c8019c0

3 files changed

Lines changed: 5 additions & 43 deletions

File tree

activesupport/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* Remove deprecated methods `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=`
2+
and `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string`.
3+
4+
*Rafael Mendonça França*
5+
16
* Remove deprecated `ActiveSupport::SafeBuffer#prepend`.
27

38
*Rafael Mendonça França*

activesupport/lib/active_support/json/encoding.rb

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ class << self
66
delegate :use_standard_json_time_format, :use_standard_json_time_format=,
77
:time_precision, :time_precision=,
88
:escape_html_entities_in_json, :escape_html_entities_in_json=,
9-
:encode_big_decimal_as_string, :encode_big_decimal_as_string=,
109
:json_encoder, :json_encoder=,
1110
:to => :'ActiveSupport::JSON::Encoding'
1211
end
@@ -114,32 +113,6 @@ class << self
114113
# in +Object#to_json+ and +ActiveSupport::JSON.encode+.
115114
attr_accessor :json_encoder
116115

117-
def encode_big_decimal_as_string=(as_string)
118-
message = \
119-
"The JSON encoder in Rails 4.1 no longer supports encoding BigDecimals as JSON numbers. Instead, " \
120-
"the new encoder will always encode them as strings.\n\n" \
121-
"You are seeing this error because you have 'active_support.encode_big_decimal_as_string' in " \
122-
"your configuration file. If you have been setting this to true, you can safely remove it from " \
123-
"your configuration. Otherwise, you should add the 'activesupport-json_encoder' gem to your " \
124-
"Gemfile in order to restore this functionality."
125-
126-
raise NotImplementedError, message
127-
end
128-
129-
def encode_big_decimal_as_string
130-
message = \
131-
"The JSON encoder in Rails 4.1 no longer supports encoding BigDecimals as JSON numbers. Instead, " \
132-
"the new encoder will always encode them as strings.\n\n" \
133-
"You are seeing this error because you are trying to check the value of the related configuration, " \
134-
"`active_support.encode_big_decimal_as_string`. If your application depends on this option, you should " \
135-
"add the 'activesupport-json_encoder' gem to your Gemfile. For now, this option will always be true. " \
136-
"In the future, it will be removed from Rails, so you should stop checking its value."
137-
138-
ActiveSupport::Deprecation.warn message
139-
140-
true
141-
end
142-
143116
# Deprecate CircularReferenceError
144117
def const_missing(name)
145118
if name == :CircularReferenceError

activesupport/test/json/encoding_test.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,22 +176,6 @@ def test_wide_utf8_roundtrip
176176
assert_equal "𐒑", decoded_hash['string']
177177
end
178178

179-
def test_reading_encode_big_decimal_as_string_option
180-
assert_deprecated do
181-
assert ActiveSupport.encode_big_decimal_as_string
182-
end
183-
end
184-
185-
def test_setting_deprecated_encode_big_decimal_as_string_option
186-
assert_raise(NotImplementedError) do
187-
ActiveSupport.encode_big_decimal_as_string = true
188-
end
189-
190-
assert_raise(NotImplementedError) do
191-
ActiveSupport.encode_big_decimal_as_string = false
192-
end
193-
end
194-
195179
def test_exception_raised_when_encoding_circular_reference_in_array
196180
a = [1]
197181
a << a

0 commit comments

Comments
 (0)