Sounds like you have a typo somewhere (maybe you've got plural instead
of singular?). Cake automatically creates models if they don't exist.
Therefore it is creating a model (an instance of AppModel) and your
method is not defined in AppModel.
Make sense?
Adam
Mr Speaker wrote:
> I think I must have some kind of scoping issue - the problem only
> occurs when I try to call a method from a Model from a different
> controller. So from the original example below, if I do:
>
> function index() {
> $this->Abc->doTest();
> }
>
> inside AbcController, then it works as expected and returns null.
> If I call it from StartController, then it gives the error below (and
> as you pointed out, looks like it tries to call AppModel::doTest not
> AbcModel::doTest)
>
> By the way, the reason I am trying to call the method from the model
> not the controller is that I was trying to follow this advice:
> http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model
> which is from a Ruby on Rails guy - so perhaps I'm just going about it
> in the wrong manner!
>
> Thanks!
>
> On Feb 18, 11:14 pm, AD7six<[email protected]> wrote:
>
>> On Feb 18, 1:01 pm, Mr Speaker<[email protected]> wrote:
>>
>>
>>> I have this same issue (exactly)... what am i doing wrong?
>>>
>> You are (both) calling a method on a (model) object that doesn't exist
>> - probably because of a misnamed file.
>>
>> "AppModel::doTest() - [internal], line ?? "<- it's an instance of
>> AppModel, not your model.
>>
>> Check the conventions page regarding filenames.
>>
>> 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
-~----------~----~----~----~------~----~------~--~---