Permalink
Browse files

Instance variable names are symbols in Ruby 1.9, so convert it to string

  • Loading branch information...
1 parent 79cb1a7 commit 2ac6f40a30baaad3b46254e8b875b29d187befaf @iain committed Mar 30, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/document/serialization/hash_serializer.rb
View
4 lib/document/serialization/hash_serializer.rb
@@ -44,7 +44,7 @@ def hashify(object_to_serialize, current_depth)
hashed_object['_class_name'] = object_to_serialize.class.name if current_depth > 0
object_to_serialize.instance_variables.each do |attribute_name|
- new_hash_key = attribute_name.sub(/^@/, '')
+ new_hash_key = attribute_name.to_s.sub(/^@/, '')
nested_object = object_to_serialize.instance_variable_get(attribute_name)
hashed_object[new_hash_key] = Serializer.serialize(nested_object, current_depth + 1)
end
@@ -71,4 +71,4 @@ def raise_unless_natively_embeddable(object)
end
end
-end
+end

0 comments on commit 2ac6f40

Please sign in to comment.