Yes. Model names are singular, and Cake pluralises them where necessary. And, 
if you were a purist, the primary key would be 'id'.

http://book.cakephp.org/view/901/CakePHP-Conventions

Jeremy Burns
Class Outfit

[email protected]
http://www.classoutfit.com

On 12 Oct 2010, at 12:43, Dan wrote:

> For this example, I'll be using the following table name: Rallies.
> It's primary key is "rally_id".
> 
> Here's the model that works:
> 
> class Rally extends AppModel {
>    var $name = 'Rally';
>    var $primaryKey = 'rally_id';
> }
> 
> However, I initially created this model:
> 
> class Rallies extends AppModel {
>    var $name = 'Rallies';
>    var $primaryKey = 'rally_id';
> }
> 
> The latter doesn't work due to the read() function getting an error:
> SQL Error: 1054: Unknown column 'Rally.id' in 'where clause'
> 
> Can I assume that the first one works because it's the way it's
> supposed to be done?
> 
> 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

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