Skip to content

Commit

Permalink
Complex struct encoding fix
Browse files Browse the repository at this point in the history
[rails#6077 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information
anayden authored and spastorino committed Jan 15, 2011
1 parent d2c17db commit a9163b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions activesupport/lib/active_support/json/encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a9163b5

Please sign in to comment.