A Ruby Hash is a very powerful collection type to use in Ruby. When working in Rails sometimes you’ll have symbols as keys or sometimes they will be strings. If you use a normal Hash these will store as different keys for the same name.
|
sample = Hash.new sample[:a] = 1 sample["a"] = 2 sample # => {:a=>1, "a"=>2} |
Rails has another version of Hash that will map…
Continue Reading »