-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
When you include Mongoid::Fields::Serializable in a class, the following code within this class will now return false instead of true: {}.is_a?(Hash)
This happens because with the inclusion of Serializable the 'nearest' Hash-Class will be 'Mongoid::Fields::Serializable::Hash'.
Naturally this is not the behaviour someone would expect.
The following Code illustrates the problem:
class TestIt
include Mongoid::Fields::Serializable
def is_hash
if( {}.is_a?(::Hash) )
puts "hash: right"
else
puts "hash: wrong"
end
end
def is_array
if( [].is_a?(Array) )
puts "array: right"
else
puts "array: wrong"
end
end
end