I\'m producing a query like the following using ActiveRecord
SELECT * FROM (`foods`) WHERE `type` = \'fruits\' AND `tags` LIKE \'%green%\' OR `tags`
Just adding my successful solution:
$this->db->where("(table.field = $variable OR table.field IS NULL)");