[eluser]beemr[/eluser]
Here, to save you a click, this is what I wrote.
To integrate a “unique” validation into models based on the Activerecord_Class_Mod library, simply tie in the object features and put your standard callback functions into application/libraries/Activerecord.php:
Code:
function is_unique($value, $field)
{
$this->validation->set_message($this->_class_name.'->is_unique','The %s "'.$value.'" is not available. Try a different %s.');
$this->db->where($field,$value);
$this->db->from($this->_table);
return ($this->db->count_all_results() == 0);
}