I am using loadModel as described here: 
http://book.cakephp.org/view/845/loadModel

$this->loadModel('User', 2);
$user = $this->User->read();

But the id parameter doesn't work. The above code always returns the
first user in the database and ignores my $id.

Do I have to configure something special to get loadModel with $id
working?


On Nov 14, 1:36 pm, "[email protected]"
<[email protected]> wrote:
> Try ClassRegistry::init('Post');
>
> On Nov 14, 7:55 am, "Dr. Loboto" <[email protected]> wrote:
>
> > Marcelo is wrong totally. App::import only include model file but not
> > create and initialize model for you asloadModelwill do.
>
> > On Nov 14, 6:10 am, Scott Dahl <[email protected]> wrote:
>
> > > Marcelo,
>
> > > Thanks for the update.  I was unaware of that.  I will stop using that and
> > > update my methods.  Thanks again.
>
> > > Scott
>
> > > On Fri, Nov 13, 2009 at 12:11 PM, Marcelo Andrade 
> > > <[email protected]>wrote:
>
> > > > On Fri, Nov 13, 2009 at 3:06 PM, Scott Dahl <[email protected]> 
> > > > wrote:
> > > > > $this->loadModel('ModelName');
> > > > > $results = $this->ModelName->find('list');
>
> > > > "loadModel" is deprecated.  Use
> > > > App::import('model', 'ModelName');
> > > > instead.
>
> > > > Best regards.
>
> > > > --
> > > > MARCELO DE F. ANDRADE
> > > > Belem, PA, Amazonia, Brazil
> > > > Linux User #221105
>
> > > > --
>
> > > > 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]<cake-php%[email protected]
> > > >  om>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=.

--

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=.


Reply via email to