# File lib/couchrest/model/casted_hash.rb, line 43
    def replace(other_hash)
      if use_dirty? && other_hash && other_hash.kind_of?(Hash)
        # new keys and changed keys
        other_hash.keys.each do |key|
          if self[key] != other_hash[key] || !include?(key) 
            couchrest_attribute_will_change!(key) 
          end
        end
        # old keys
        old_keys = self.keys.reject { |key| other_hash.include?(key) }
        old_keys.each { |key| couchrest_attribute_will_change!(key) }
      end

      super(other_hash)
    end