I am having some problems with my controllers. I followed the Blog 1.2
tutorial and it worked like a charm. I understood how it worked so I
started my project for recipes. The very first thing I did failed and
I dont know why. I have been staring at these files for like an hour
and I cant see what's wrong. When I request:

http://localhost/recipe_manager/site/ingredient/index

Cake tells me that I need to create singular controller:

Error:  IngredientController could not be found.
Error: Create the class IngredientController below in file: app
\controllers\ingredient_controller.php

I have posted all my code below with the corresponding file names. Any
help would be greatly appreciated.



MySQL table

CREATE TABLE `ingredients` (
  `id` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `ingredient` varchar(64) NOT NULL DEFAULT '',
  `ingredient_type_id` int(10) unsigned zerofill NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_ingredient` (`ingredient`),
  KEY `FK_ingredient_type_id` (`ingredient_type_id`),
  CONSTRAINT `FK_ingredient_type_id` FOREIGN KEY
(`ingredient_type_id`) REFERENCES `ingredient_types` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=latin1;






app\models\ingredient.php

class Ingredient extends AppModel
{

}





app\controllers\ingredients_controller.php

class IngredientsController extends AppController
{

        function index()
        {
                $this->set('ingredients', $this->Ingredient->findAll());
        }
}







app\views\ingredients\index.ctp

<h1>Ingredients</h1>
<table>
        <tr>
                <th>Id</th>
                <th>Ingredient</th>
                <th>Created</th>
        </tr>

        <!-- Here is where we loop through our $posts array, printing out
post info -->

        <?php foreach ($ingredients as $ingredient): ?>
        <tr>
                <td><?php echo $ingredient['Ingredient']['id']; ?></td>
                <td>
                        <?php echo 
$html->link($ingredient['Ingredient']['ingredient'], "/
ingredients/view/".$ingredient['Ingredient']['id']); ?>
                </td>
                <td><?php echo $ingredient['Ingredient']['created']; ?></td>
        </tr>
        <?php endforeach; ?>

</table>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to