On Feb 18, 11:40 pm, Mr Speaker <[email protected]> wrote:
> Perhaps I have a plural typo, but I'm not sure - because the call from
> the model's own controller works - only if you call from a DIFFERENT
> controller does it not work. Here's a test I did:
>
> class Message extends AppModel {
>     var $name = 'Message';
>     function get_message() {
>         $message = $this->find('first');
>         return $message['Message']['title'];
>     }
>
> }
>
> class MessagesController extends AppController {
>     var $name = "Messages";
>     function get_message() {
>         $this->set( 'message', $this->Message->get_message() );
>     }
>
> }
>
> And the view get_message.ctp is just: <?php echo $message ?>. If I
> then go to /cake/messages/get_message then it works as expected: "TEST
> MESSAGE! W00T!"
>
> But if I then add another model:
> class Test extends AppModel
> {
>     var $name = 'Test';
>         var $useTable = false;
>
> }
>
> class TestsController extends AppController {
>     var $name = "Tests";
>     var $uses = array( 'Messages' );

$uses is for models, and models are singular - see the conventions
page in the book.

hth,

AD
--~--~---------~--~----~------------~-------~--~----~
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