module ActionDispatch::Flash::RequestMethods

def commit_flash # :nodoc:

:nodoc:
def commit_flash # :nodoc:
  return unless session.enabled?
  if flash_hash && (flash_hash.present? || session.key?("flash"))
    session["flash"] = flash_hash.to_session_value
    self.flash = flash_hash.dup
  end
  if session.loaded? && session.key?("flash") && session["flash"].nil?
    session.delete("flash")
  end
end