diff options
author | Alexey Nayden <alexey.nayden@gmail.com> | 2011-01-13 03:17:47 +0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-01-15 00:06:26 -0200 |
commit | a9163b547c7cfd4861c814371fa9d1a6bdb31231 (patch) | |
tree | 1cc7dec365132bb54306814c9ba53ee8a92eb982 | |
parent | d2c17dbd11417012c47b9ac48c62651a1415de5d (diff) | |
download | rails-a9163b547c7cfd4861c814371fa9d1a6bdb31231.tar.gz rails-a9163b547c7cfd4861c814371fa9d1a6bdb31231.tar.bz2 rails-a9163b547c7cfd4861c814371fa9d1a6bdb31231.zip |
Complex struct encoding fix
[#6077 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
-rw-r--r-- | activesupport/lib/active_support/json/encoding.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index c8cac52027..b2ea196003 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -153,6 +153,12 @@ class Object 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: |