aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md16
-rw-r--r--activesupport/lib/active_support/json/variable.rb10
-rw-r--r--activesupport/test/json/encoding_test.rb11
3 files changed, 14 insertions, 23 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 180b93be10..045ac4cde6 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,14 +1,18 @@
## Rails 3.2.8 ##
-* No changes.
+* Reverted the deprecation of ActiveSupport::JSON::Variable. *Rafael Mendonça França*
## Rails 3.2.7 (Jul 26, 2012) ##
-* Hash#fetch(fetch) is not the same as doing hash[key]
-* adds a missing require [fixes #6896]
-* make sure the inflection rules are loaded when cherry-picking active_support/core_ext/string/inflections.rb [fixes #6884]
-* Merge pull request #6857 from rsutphin/as_core_ext_time_missing_require
-* bump AS deprecation_horizon to 4.0
+* Hash#fetch(fetch) is not the same as doing hash[key]
+
+* adds a missing require [fixes #6896]
+
+* make sure the inflection rules are loaded when cherry-picking active_support/core_ext/string/inflections.rb [fixes #6884]
+
+* Merge pull request #6857 from rsutphin/as_core_ext_time_missing_require
+
+* bump AS deprecation_horizon to 4.0
## Rails 3.2.6 (Jun 12, 2012) ##
diff --git a/activesupport/lib/active_support/json/variable.rb b/activesupport/lib/active_support/json/variable.rb
index 17b709decc..5685ed18b7 100644
--- a/activesupport/lib/active_support/json/variable.rb
+++ b/activesupport/lib/active_support/json/variable.rb
@@ -1,15 +1,7 @@
-require 'active_support/deprecation'
-
module ActiveSupport
module JSON
- # Deprecated: A string that returns itself as its JSON-encoded form.
+ # A string that returns itself as its JSON-encoded form.
class Variable < String
- def initialize(*args)
- ActiveSupport::Deprecation.warn 'ActiveSupport::JSON::Variable is deprecated and will be removed in Rails 4.0. ' \
- 'For your own custom JSON literals, define #as_json and #encode_json yourself.'
- super
- end
-
def as_json(options = nil) self end #:nodoc:
def encode_json(encoder) self end #:nodoc:
end
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index d327f34140..a9590f164f 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -3,7 +3,7 @@ require 'abstract_unit'
require 'active_support/core_ext/string/inflections'
require 'active_support/json'
-class TestJSONEncoding < ActiveSupport::TestCase
+class TestJSONEncoding < Test::Unit::TestCase
class Foo
def initialize(a, b)
@a, @b = a, b
@@ -46,6 +46,8 @@ class TestJSONEncoding < ActiveSupport::TestCase
HashlikeTests = [[ Hashlike.new, %({\"a\":1}) ]]
CustomTests = [[ Custom.new, '"custom"' ]]
+ VariableTests = [[ ActiveSupport::JSON::Variable.new('foo'), 'foo'],
+ [ ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")']]
RegexpTests = [[ /^a/, '"(?-mix:^a)"' ], [/^\w{1,2}[a-z]+/ix, '"(?ix-m:^\\\\w{1,2}[a-z]+)"']]
DateTests = [[ Date.new(2005,2,1), %("2005/02/01") ]]
@@ -77,13 +79,6 @@ class TestJSONEncoding < ActiveSupport::TestCase
end
end
- def test_json_variable
- assert_deprecated do
- assert_equal ActiveSupport::JSON::Variable.new('foo'), 'foo'
- assert_equal ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")'
- end
- end
-
def test_hash_encoding
assert_equal %({\"a\":\"b\"}), ActiveSupport::JSON.encode(:a => :b)
assert_equal %({\"a\":1}), ActiveSupport::JSON.encode('a' => 1)