Wednesday, May 23, 2012

Adding new Model

Forgive me if this is trivial, I am new to cake.

I created this model:

<?php
class CreditCard extends AppModel {
var $name='CreditCard';
}
?>

For this table:
credit_cards | CREATE TABLE `credit_cards` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`renter_id` int(10) unsigned NOT NULL,
`name` char(100) COLLATE utf8_unicode_ci NOT NULL,
`address` char(125) COLLATE utf8_unicode_ci NOT NULL,
`cc_num` char(15) COLLATE utf8_unicode_ci NOT NULL,
`expiration` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |


When I add the model to the $uses array $uses=array('CreditCard') of
a controller, whatever page I am trying to access gives this error:

Not Found

Error: The requested address '/controller/action' was not found on
this server.

if in the model I add this line:
var $useTable=false;

Problem goes away. But I kind of need to write to the table.

What am I missing?

Thanks

--
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: