⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Unable to locate the model you have specified: Grocery_CRUD_Model



Faisal Naseer
  • profile picture
  • Member

Posted 20 May 2016 - 13:42 PM

In my application I am having an controller responsible for error Unable to locate the model you have specified: Grocery_CRUD_Model  however I am not specifying any type of model naming Grocery_CRUD_Model

 

 

 

My controller:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class ExecutiveMembers extends CI_Controller
{

public function __construct()
{
parent::__construct();

$this->load->database();
$this->load->helper('url');
$this->load->model('CommitteeMembers');
$this->load->library('grocery_CRUD');
}

public function _example_output($output = null)
{
$this->load->view('members_view', $output);
}

public function index()
{
try {
$crud = new grocery_CRUD();
$crud->set_theme('bootstrap');
$crud->set_table('ExecutiveMember');
$crud->unset_add();
$crud->unset_edit();
$crud->columns('member_name', 'member_designation');
$crud->add_action('Update', '', 'ordered_products/update_order', 'ui-icon-plus');
$crud->display_as('member_name', 'Member Name')
->display_as('member_description', 'Member Designation');
$crud->set_subject('Members Details');
$output = $crud->render();
$this->_example_output($output);
}catch(Exception $e){
show_error($e->getMessage().' --- '.$e->getTraceAsString());
}
}
}

 

Error

Unable to locate the model you have specified: Grocery_CRUD_Model --- #0 /home/drkkayani/public_html/ClubApp/application/libraries/Grocery_CRUD.php(484): CI_Loader->model('grocery_CRUD_Mo...') #1 /home/drkkayani/public_html/ClubApp/application/libraries/Grocery_CRUD.php(4425): grocery_CRUD_Model_Driver->set_default_Model() #2 /home/drkkayani/public_html/ClubApp/application/libraries/Grocery_CRUD.php(4443): Grocery_CRUD->pre_render() #3 /home/drkkayani/public_html/ClubApp/application/controllers/ExecutiveMembers.php(34): Grocery_CRUD->render() #4 [internal function]: ExecutiveMembers->index() #5 /home/drkkayani/public_html/ClubApp/system/core/CodeIgniter.php(514): call_user_func_array(Array, Array) #6 /home/drkkayani/public_html/ClubApp/index.php(292): require_once('/home/drkkayani...') #7 {main}


Amit Shah
  • profile picture
  • Member

Posted 20 May 2016 - 17:52 PM

Hi there,

 

Linux is a very Case sensitive system.. and now so is Codeigniter latest editions.. its very strict on case of the class names.

Go to the models folder.. find the GC model file .. and rename to whatever it may have been .. to Grocery_CRUD_Model.php

That should resolve your problem.

 

Happy GCing :)