How would I reverse the elements in the hash, keeping the same values and keys, but reversing their order in the hash.
Like so:
{ \"4\" => \"happiness
In pure ruby, you can do it by hash.map(&:reverse).to_h or hash.reverse_each.to_h
hash.map(&:reverse).to_h
hash.reverse_each.to_h
In rails, you can do it by hash.invert
hash.invert