Permalink
Browse files

Complex struct encoding fix

[#6077 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent d2c17db commit a9163b547c7cfd4861c814371fa9d1a6bdb31231 @anayden anayden committed with spastorino Jan 13, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 activesupport/lib/active_support/json/encoding.rb
@@ -153,6 +153,12 @@ def as_json(options = nil) #:nodoc:
end
end
+class Struct
+ def as_json(options = nil) #:nodoc:
+ Hash[members.zip(values)]
+ end
+end
+
class TrueClass
AS_JSON = ActiveSupport::JSON::Variable.new('true').freeze
def as_json(options = nil) AS_JSON end #:nodoc:

0 comments on commit a9163b5

Please sign in to comment.