diff options
Diffstat (limited to 'activeresource/lib/active_resource/formats.rb')
-rw-r--r-- | activeresource/lib/active_resource/formats.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activeresource/lib/active_resource/formats.rb b/activeresource/lib/active_resource/formats.rb index 53b75b34e7..f7ad689cc5 100644 --- a/activeresource/lib/active_resource/formats.rb +++ b/activeresource/lib/active_resource/formats.rb @@ -10,5 +10,13 @@ module ActiveResource def self.[](mime_type_reference) ActiveResource::Formats.const_get(ActiveSupport::Inflector.camelize(mime_type_reference.to_s) + "Format") end + + def self.remove_root(data) + if data.is_a?(Hash) && data.keys.size == 1 + data.values.first + else + data + end + end end end |