Hi John,

> 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

There's usually no need for this, as the controller knows which the
main model is. From the API

$this->modelClass       
"This controller's primary model class name, the
Inflector::classify()'ed version of the controller's $name property.
Example: For a controller named 'Comments', the modelClass would be 'Comment'"

So you can do the following in AppController.

$this->{$this->modelClass}->save();

hth

Jon



-- 
jon bennett - www.jben.net - blog.jben.net

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