-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
as you can see in the following example, when I call the [] operator with a key that is not present in the hash an error is raised
ruby-1.9.2-p180 :020 > class MyHash < ::Hash; include Mongoid::Fields::Serializable; end
=> MyHash
ruby-1.9.2-p180 :021 > h = MyHash.new
=> {}
ruby-1.9.2-p180 :022 > h["do-not-exist"]
ArgumentError: wrong number of arguments (1 for 0)
from (irb):22:in `[]'
from (irb):22
from /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'
ruby-1.9.2-p180 :023 > h["do-not-exist"] = 1
=> 1
ruby-1.9.2-p180 :024 > h["do-not-exist"]
=> 1