I am a new Ruby programmer, and a co-worker of mine to help me get started wrote the following code which ran fine in his environment. However, when I try to run it in my own e
Try using:
require 'active_support/core_ext/hash'
Thats what actually adds the with_indifferent_access
method to the normal Hash class.
By the way, HashWithIndifferentAccess is really powerful as long as you use it with caution.
For example:
h = HashWithIndifferentAccess.new()
some_array.each do |a|
h["#{a}"] = "anything you want"
end
I use it all the time when working with slices of data in metrics.