When your form invoke the Add method, it does so using the
LocationsController, thus when the AppController (which is parent of
LocationsController) you can take the controllers name - $this->name -
which in your case will give you "Locations", then use the Inflector
to give you the Model name. And voila, you can work with the model :)

Inflector at: http://book.cakephp.org/view/491/Inflector

Enjoy,
   John

On Feb 26, 10:25 am, sebb86 <[email protected]> wrote:
> John,
>
> Hello and thanks for your help.
>
> "Are your controllers only using one model and the models is named the
> same as the controller (singular)? If that is so, you don't need to
> pass the model, just take your controllers name and Inflect it into a
> model name and use that!
> "
>
> Yes, for example i have a controller: LocationsController with a
> model: location.
> But how can i make the add-function in the appController dynamical?
> I tryed to pass $model with the current model name from the current
> controller to the appController but it dont works.
>
> Could you tell me, how to pass the model name?
>
> Thanks! :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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