class Devise::ParameterSanitizer

def cast_to_hash(params)

Returns an +ActiveSupport::HashWithIndifferentAccess+.

that can be used elsewhere.
Cast a sanitized +ActionController::Parameters+ to a +HashWithIndifferentAccess+
def cast_to_hash(params)
  # TODO: Remove the `with_indifferent_access` method call when we only support Rails 5+.
  params && params.to_h.with_indifferent_access
end