aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 22:22:16 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-04 11:58:40 -0300
commitc8019c0611791b2716c6bed48ef8dcb177b7869c (patch)
tree848d602ee1bc481d0aef68bb4c8c07df3c85a8ba /activesupport
parente1c8b9f688c56aaedac9466a4343df955b4a67ec (diff)
downloadrails-c8019c0611791b2716c6bed48ef8dcb177b7869c.tar.gz
rails-c8019c0611791b2716c6bed48ef8dcb177b7869c.tar.bz2
rails-c8019c0611791b2716c6bed48ef8dcb177b7869c.zip
Remove deprecated ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md5
-rw-r--r--activesupport/lib/active_support/json/encoding.rb27
-rw-r--r--activesupport/test/json/encoding_test.rb16
3 files changed, 5 insertions, 43 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index cb39c8edd0..017a306c1b 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,3 +1,8 @@
+* Remove deprecated methods `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=`
+ and `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string`.
+
+ *Rafael Mendonça França*
+
* Remove deprecated `ActiveSupport::SafeBuffer#prepend`.
*Rafael Mendonça França*
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index c0ac5af153..20833eff90 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -6,7 +6,6 @@ module ActiveSupport
delegate :use_standard_json_time_format, :use_standard_json_time_format=,
:time_precision, :time_precision=,
:escape_html_entities_in_json, :escape_html_entities_in_json=,
- :encode_big_decimal_as_string, :encode_big_decimal_as_string=,
:json_encoder, :json_encoder=,
:to => :'ActiveSupport::JSON::Encoding'
end
@@ -114,32 +113,6 @@ module ActiveSupport
# in +Object#to_json+ and +ActiveSupport::JSON.encode+.
attr_accessor :json_encoder
- def encode_big_decimal_as_string=(as_string)
- message = \
- "The JSON encoder in Rails 4.1 no longer supports encoding BigDecimals as JSON numbers. Instead, " \
- "the new encoder will always encode them as strings.\n\n" \
- "You are seeing this error because you have 'active_support.encode_big_decimal_as_string' in " \
- "your configuration file. If you have been setting this to true, you can safely remove it from " \
- "your configuration. Otherwise, you should add the 'activesupport-json_encoder' gem to your " \
- "Gemfile in order to restore this functionality."
-
- raise NotImplementedError, message
- end
-
- def encode_big_decimal_as_string
- message = \
- "The JSON encoder in Rails 4.1 no longer supports encoding BigDecimals as JSON numbers. Instead, " \
- "the new encoder will always encode them as strings.\n\n" \
- "You are seeing this error because you are trying to check the value of the related configuration, " \
- "`active_support.encode_big_decimal_as_string`. If your application depends on this option, you should " \
- "add the 'activesupport-json_encoder' gem to your Gemfile. For now, this option will always be true. " \
- "In the future, it will be removed from Rails, so you should stop checking its value."
-
- ActiveSupport::Deprecation.warn message
-
- true
- end
-
# Deprecate CircularReferenceError
def const_missing(name)
if name == :CircularReferenceError
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index 7e976aa772..48f634a78b 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -176,22 +176,6 @@ class TestJSONEncoding < ActiveSupport::TestCase
assert_equal "𐒑", decoded_hash['string']
end
- def test_reading_encode_big_decimal_as_string_option
- assert_deprecated do
- assert ActiveSupport.encode_big_decimal_as_string
- end
- end
-
- def test_setting_deprecated_encode_big_decimal_as_string_option
- assert_raise(NotImplementedError) do
- ActiveSupport.encode_big_decimal_as_string = true
- end
-
- assert_raise(NotImplementedError) do
- ActiveSupport.encode_big_decimal_as_string = false
- end
- end
-
def test_exception_raised_when_encoding_circular_reference_in_array
a = [1]
a << a