diff options
Diffstat (limited to 'activesupport/lib/active_support/json/encoders/object.rb')
-rw-r--r-- | activesupport/lib/active_support/json/encoders/object.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/json/encoders/object.rb b/activesupport/lib/active_support/json/encoders/object.rb new file mode 100644 index 0000000000..51852e17cb --- /dev/null +++ b/activesupport/lib/active_support/json/encoders/object.rb @@ -0,0 +1,10 @@ +class Object + # Dumps object in JSON (JavaScript Object Notation). See www.json.org for more info. + # + # Account.find(1).to_json + # => "{attributes: {username: \"foo\", id: \"1\", password: \"bar\"}}" + # + def to_json + ActiveSupport::JSON.encode(instance_values) + end +end |