module ActiveSupport::CoreExtensions::Hash::ReverseMerge

def reverse_merge(other_hash)

Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
def reverse_merge(other_hash)
  other_hash.merge(self)
end

def reverse_merge!(other_hash)

Modifies the receiver in place.
Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
def reverse_merge!(other_hash)
  replace(reverse_merge(other_hash))
end