class ActionController::Parameters

def to_h(&block)

safe_params.to_h # => {"name"=>"Senjougahara Hitagi"}
safe_params = params.permit(:name)

# => ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
params.to_h
})
oddity: "Heavy stone crab"
name: "Senjougahara Hitagi",
params = ActionController::Parameters.new({

representation of the parameters with all unpermitted keys removed.
Returns a safe ActiveSupport::HashWithIndifferentAccess
def to_h(&block)
  if permitted?
    convert_parameters_to_hashes(@parameters, :to_h, &block)
  else
    raise UnfilteredParameters
  end
end