Monday, March 19, 2012

hasAndBelongsToMany

Hi,

I have Recipe hasAndBelongsToMany Ingredient.

I want to be able to browse ingredients of the recipe using next/prev navigation.
Should it be done in RecipesController, or the IngredientsController?

The way i see it is, if I use ingredients/view to display an ingredient, I have no way of knowing which Recipe I'm in (because same ingredient might be used in multiple recipes) unless i keep track of the recipe_id in some way.
If i use recipes/viewIngredient instead, i now have to keep track of the ingredient_id... Doesn't seem nice either.

Or am i doing/understanding something totally wrong here? I mean, maybe I should use IngredientsRecipesController, or something else yet?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: