On Oct 30, 12:10 ¨Âí¬ óèåîòù ¼óôõáòôèå®®®Àçíáéì®ãïí÷òïôåº > I'm trying to merge to hashes, one using symbols as keys (the defined > default values for my class) and the other using strings as keys > (taken from the params hash). > > default = { :name => "Joe", :age => 50 } > > params = { "name" => "Bill" } > > new_hash = default.merge(params) > > >> { :name => "Joe", :age => 50, "name" => "Bill } > > What's the Ruby way to handle this so that it overwrites :name with > "name"? Do I need to implement a stringify_keys or symbolize_keys > method like in Rails? I'd like to avoid using strings as the keys in > my default hash. > > Any help greatly appreciated. require 'facets/hash/rekey' default.merge(params.rekey) rekey takes a block, without a block it is the same as: rekey(&:to_sym)