class ActionController::ParamsWrapper::Options

def _default_wrap_model

try to find Foo::Bar::User, Foo::User and finally User.
This method also does namespace lookup. Foo::Bar::UsersController will

will try to find if the +User+ model exists.
same singular name as the controller. For example, +UsersController+
this could be done by trying to find the defined model that has the
Determine the wrapper model from the controller's name. By convention,
def _default_wrap_model
  return nil if klass.anonymous?
  model_name = klass.name.delete_suffix("Controller").classify
  begin
    if model_klass = model_name.safe_constantize
      model_klass
    else
      namespaces = model_name.split("::")
      namespaces.delete_at(-2)
      break if namespaces.last == model_name
      model_name = namespaces.join("::")
    end
  end until model_klass
  model_klass
end