1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #6554 from erichmenge/remove-json-variable

Remove deprecated ActiveSupport::JSON::Variable.
This commit is contained in:
Piotr Sarnacki 2012-05-30 13:04:33 -07:00
commit aab0d4e2c6
4 changed files with 7 additions and 14 deletions

View file

@ -1,7 +1,7 @@
## Rails 4.0.0 (unreleased) ##
* ActionView::Helpers::NumberHelper methods have been moved to ActiveSupport::NumberHelper and are now available via
Numeric#to_s. Numeric#to_s now accepts the formatting options :phone, :currency, :percentage, :delimited,
* ActionView::Helpers::NumberHelper methods have been moved to ActiveSupport::NumberHelper and are now available via
Numeric#to_s. Numeric#to_s now accepts the formatting options :phone, :currency, :percentage, :delimited,
:rounded, :human, and :human_size. *Andrew Mutz*
* Add `Hash#transform_keys`, `Hash#transform_keys!`, `Hash#deep_transform_keys`, and `Hash#deep_transform_keys!`. *Mark McSpadden*
@ -57,12 +57,17 @@
* Adds `encode_big_decimal_as_string` option to force JSON serialization of BigDecimals as numeric instead
of wrapping them in strings for safety.
* Remove deprecated ActiveSupport::JSON::Variable. *Erich Menge*
## Rails 3.2.4 (unreleased) ##
* Added #beginning_of_hour and #end_of_hour to Time and DateTime core
extensions. *Mark J. Titorenko*
* ActiveSupport::JSON::Variable is deprecated. Define your own #as_json and #encode_json methods
for custom JSON string literals. *Erich Menge*
## Rails 3.2.3 (March 30, 2012) ##

View file

@ -1,6 +1,5 @@
require 'active_support/core_ext/object/to_json'
require 'active_support/core_ext/module/delegation'
require 'active_support/json/variable'
require 'bigdecimal'
require 'active_support/core_ext/big_decimal/conversions' # for #to_s

View file

@ -1,9 +0,0 @@
module ActiveSupport
module JSON
# A string that returns itself as its JSON-encoded form.
class Variable < String
def as_json(options = nil) self end #:nodoc:
def encode_json(encoder) self end #:nodoc:
end
end
end

View file

@ -54,8 +54,6 @@ 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") ]]