|
@@ -6,6 +6,16 @@ module ActiveResource
|
|
|
|
|
|
same.send("to_#{self.class.format.extension}", options)
|
|
|
end
|
|
|
+
|
|
|
+ def as_json(options = nil)
|
|
|
+ root = options[:root] if options.try(:key?, :root)
|
|
|
+ if include_root_in_json
|
|
|
+ root = self.class.model_name.element if root == true
|
|
|
+ { root => serializable_hash(options) }
|
|
|
+ else
|
|
|
+ serializable_hash(options)
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
module Formats
|
|
@@ -21,19 +31,3 @@ module ActiveResource
|
|
|
end
|
|
|
end
|
|
|
end
|
|
|
-
|
|
|
-module ActiveModel
|
|
|
- module Serializers
|
|
|
- module JSON
|
|
|
- def as_json(options = nil)
|
|
|
- root = options[:root] if options.try(:key?, :root)
|
|
|
- if include_root_in_json
|
|
|
- root = self.class.model_name.element if root == true
|
|
|
- { root => serializable_hash(options) }
|
|
|
- else
|
|
|
- serializable_hash(options)
|
|
|
- end
|
|
|
- end
|
|
|
- end
|
|
|
- end
|
|
|
-end
|