I have two tables, table_a and table_b. Both have a 'type' field. I am filtering table_a by the type column and then setting a relation to a field in table_b.
Here is the code:
$crud = new grocery_CRUD();
$crud->where('type', 'food');
$crud->set_theme('datatables');
$crud->set_table('table_a');
$crud->set_relation('contact', 'table_b', '{firstName} {lastName}');
$output = $crud->render();
$output = (array)$output;
$this->output($output);
The problem is that this returns a database error saying that 'type' on the where() is ambiguous. OK, no problem, I've had this error before on callback_column and followed this solution to get a unique field name. The problem is that I tried to use that on the where clause:
$crud->where($this->unique_field_name('type'), 'food');
And that returns a database error of 'unknown column' for the where().
Is there any solution besides changing the name of one of the fields?