Browse files

Merge branch '2-3-stable' of git@github.com:rails/rails into 2-3-stable

  • Loading branch information...
2 parents 8dab61d + 55501b9 commit 4b331554288aaafb35a4cc511810c3b61cf2c2b5 @jeremy jeremy committed Aug 5, 2009
Showing with 5 additions and 3 deletions.
  1. +5 −3 activerecord/lib/active_record/serializers/json_serializer.rb
View
8 activerecord/lib/active_record/serializers/json_serializer.rb
@@ -74,13 +74,15 @@ def self.included(base)
# {"comments": [{"body": "Don't think too hard"}],
# "title": "So I was thinking"}]}
def to_json(options = {})
+ super
+ end
+
+ def as_json(options = nil) #:nodoc:
hash = Serializer.new(self, options).serializable_record
hash = { self.class.model_name.element => hash } if include_root_in_json
- ActiveSupport::JSON.encode(hash)
+ hash
end
- def as_json(options = nil) self end #:nodoc:
-
def from_json(json)
self.attributes = ActiveSupport::JSON.decode(json)
self

0 comments on commit 4b33155

Please sign in to comment.