I have form_validation
library loaded in my config:
$autoload['libraries'] = array('database','session','form_validation');
And I have next method in one of my Controllers:
public function add(){
//Validation Rules
$this->form->validation->set_rules('title','Title','trim|required|max_length[4]|xss_clean');
$this->form->validation->set_rules('body','Body','trim|required|xss+clean');
$this->form->validation->set_rules('is_published','Publish','required');
$this->form->validation->set_rules('category','Category','required');
//
//
//
}
}
And it gives me next error:
Fatal error: Call to a member function set_rules() on null
It feels like it's not working because form_validation
library is not loaded, but it's auto loaded in config, I've also tried to load it directly in controllers constructor, and it didn't help.
What can be causing the error?