This project is archived and is in readonly mode.

Changeset [d052e9fb5868a10df33a84bf61f40a32df9e78ec] by rick

May 18th, 2009 @ 02:40 AM

Add pluggable JSON backends with support for the JSON gem.

Example: ActiveSupport::JSON.backend = "JSONGem"

All internal Rails JSON encoding is now handled by ActiveSupport::JSON.encode(). Use of #to_json is not recommended, as it may clash with other libraries that overwrite it. However, you can recover Rails specific functionality if you really want to use #to_json.

gem 'json'
ActiveSupport::JSON.backend = "JSONGem"

class ActiveRecord::Base
  alias to_json rails_to_json
end

http://github.com/rails/rails/co...

Committed by rick

  • M actionpack/lib/action_controller/base.rb
  • M actionpack/lib/action_view/helpers/prototype_helper.rb
  • M actionpack/lib/action_view/helpers/scriptaculous_helper.rb
  • M actionpack/test/controller/render_test.rb
  • M actionpack/test/template/prototype_helper_test.rb
  • M activerecord/lib/active_record/serializers/json_serializer.rb
  • M activerecord/test/cases/json_serialization_test.rb
  • M activeresource/lib/active_resource/base.rb
  • M activesupport/lib/active_support/json.rb
  • M activesupport/lib/active_support/json/backends/jsongem.rb
  • M activesupport/lib/active_support/json/backends/yaml.rb
  • M activesupport/lib/active_support/json/decoding.rb
  • M activesupport/lib/active_support/json/encoders/date.rb
  • M activesupport/lib/active_support/json/encoders/date_time.rb
  • M activesupport/lib/active_support/json/encoders/enumerable.rb
  • M activesupport/lib/active_support/json/encoders/false_class.rb
  • M activesupport/lib/active_support/json/encoders/hash.rb
  • M activesupport/lib/active_support/json/encoders/nil_class.rb
  • M activesupport/lib/active_support/json/encoders/numeric.rb
  • M activesupport/lib/active_support/json/encoders/object.rb
  • M activesupport/lib/active_support/json/encoders/regexp.rb
  • M activesupport/lib/active_support/json/encoders/string.rb
  • M activesupport/lib/active_support/json/encoders/symbol.rb
  • M activesupport/lib/active_support/json/encoders/time.rb
  • M activesupport/lib/active_support/json/encoders/true_class.rb
  • M activesupport/lib/active_support/json/encoding.rb
  • M activesupport/lib/active_support/json/variable.rb
  • M activesupport/lib/active_support/time_with_zone.rb
  • M activesupport/test/core_ext/time_with_zone_test.rb
  • M activesupport/test/json/decoding_test.rb
  • M activesupport/test/json/encoding_test.rb

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>