This project is archived and is in readonly mode.

Changeset [3c4c6bd0df598f865f49a983b4c65c415af4bcfc] by rick

April 23rd, 2009 @ 08:08 AM

  • Add pluggable JSON backends with support for the JSON gem. [rick] 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/render.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/CHANGELOG
  • 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>