[eluser]janogarcia[/eluser]
If you really need that you could try loading the required model by editing the following lines:
Code:
// >>> START of modification
$model = FALSE;
if (strpos($rule, '_model') AND $param)
{
$model = $param;
$rule = substr($rule, 0, -6);
}
// Is the callback into a model?
if ($model)
{
if ( ! method_exists($this->CI->$model, $rule))
{
continue;
}
// Run the function and grab the result
$result = $this->CI->$model->$rule($postdata);
}
else
{
if ( ! method_exists($this->CI, $rule))
{
continue;
}
// Run the function and grab the result
$result = $this->CI->$rule($postdata, $param);
}
// <<< END of modification
We'll check whether the model is already loaded. If not we'll try to load it.
WARNING: This code is
not tested and is based on an older than v1.7.3 CodeIgniter release. This code doesn't search for models within subfolders, doesn't take into account model name aliases and assumes your model class will be named following the CodeIgniter coding conventions (first letter capitalized with the rest of the name lowercase or underscore).
Code:
// >>> START of modification
$model = FALSE;
if (strpos($rule, '_model') AND $param)
{
$model = $param;
$rule = substr($rule, 0, -6);
}
// Is the callback into a model?
if ($model)
{
if ( ! isset($this->CI->$model))
{
// If you need to auto-connect to the default database add TRUE on the last parameter
// $this->CI->load->model(ucfirst($model), '', TRUE);
$this->CI->load->model(ucfirst($model);
}
if ( ! method_exists($this->CI->$model, $rule))
{
continue;
}
// Run the function and grab the result
$result = $this->CI->$model->$rule($postdata);
}
else
{
if ( ! method_exists($this->CI, $rule))
{
continue;
}
// Run the function and grab the result
$result = $this->CI->$rule($postdata, $param);
}
// <<< END of modification