blob: 898990a59c741f2bfd784fbe87b75e700dbe843c (
plain) (
tree)
|
|
module Enumerable
private
# 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 <tt>:only => :name</tt> option to each user.
def rails_to_json(options = nil, *args) #:nodoc:
"[#{map { |value| ActiveSupport::JSON.encode(value, options, *args) } * ','}]"
end
end
|