Reverse keys and values in a hash


#1

Hello all,

This is more of a ruby question than a rails question, but I’m
wondering if it’s possible to reverse the keys and values in a hash.

I’m using a hash to map fields from one component of my app to
another, and sometimes the data needs to go “the other way”…

Thanks!


#2

http://www.noobkit.com/show/ruby/ruby/ruby-core/hash/invert.html