From 1d9f0af24361e55718d9c4c68de74fe1cfdd1512 Mon Sep 17 00:00:00 2001 From: Claudio Poli Date: Fri, 15 Jul 2011 23:58:41 +0200 Subject: [PATCH] Make Rails' respond_with play nice with to_json. --- lib/fog/core/collection.rb | 4 ++-- lib/fog/core/model.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fog/core/collection.rb b/lib/fog/core/collection.rb index 214ae2e79..0af9d33e3 100644 --- a/lib/fog/core/collection.rb +++ b/lib/fog/core/collection.rb @@ -115,9 +115,9 @@ module Fog Formatador.display_table(self.map {|instance| instance.attributes}, attributes) end - def to_json + def to_json(options = {}) require 'json' - self.map {|member| member.attributes}.to_json + self.map {|member| member.attributes}.to_json(options) end private diff --git a/lib/fog/core/model.rb b/lib/fog/core/model.rb index 372cf3498..c663e97c3 100644 --- a/lib/fog/core/model.rb +++ b/lib/fog/core/model.rb @@ -37,9 +37,9 @@ module Fog self end - def to_json + def to_json(options = {}) require 'json' - attributes.to_json + attributes.to_json(options) end def wait_for(timeout=Fog.timeout, interval=1, &block)