From 7c3581cba243aa17a9f002b40c5f017d8e968492 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 24 Oct 2007 16:21:46 +0000 Subject: Document Enumerable and Hash #to_json. Add test for hash with integer key. Closes #9970. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8010 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/json/encoders/enumerable.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activesupport/lib/active_support/json/encoders/enumerable.rb') diff --git a/activesupport/lib/active_support/json/encoders/enumerable.rb b/activesupport/lib/active_support/json/encoders/enumerable.rb index d180049663..720fd88f90 100644 --- a/activesupport/lib/active_support/json/encoders/enumerable.rb +++ b/activesupport/lib/active_support/json/encoders/enumerable.rb @@ -1,4 +1,11 @@ module Enumerable + # Returns a JSON string representing the enumerable. Any +options+ + # given will be passed on to its elements. For example: + # + # users = User.find(:all) + # users.to_json(:only => :name) + # + # will pass the :only => :name option to each user. def to_json(options = {}) #:nodoc: "[#{map { |value| ActiveSupport::JSON.encode(value, options) } * ', '}]" end -- cgit v1.2.3