Sunday, May 3, 2009

Re: After baked a MVC for "keywords", how to view only "keywords" filtered by user?

Adjust the conditions in the controller's $paginate array.

function index() {
$this->Keyword->recursive = 0;

$this->paginate['conditions'] = array(
'Keyword.user_id' => $user_id
);
$this->set('keywords', $this->paginate());
}

But this seems really strange. Does the keywords table really have a
user_id column? How are your models associated?

On Sun, May 3, 2009 at 4:54 PM, AGD <anibaldamiao@gmail.com> wrote:
>
> Hi
> I've successfully added some user access control and now would like to
> change the views to show only keywords related to that specific user.
> How should i do it?
>
> For instance for the keywords/index page, i have this simple
> controller (baked):
>
>        function index() {
>                $this->Keyword->recursive = 0;
>                $this->set('keywords', $this->paginate());
>        }
>
> but this shows all "keywords" in the DB and i would like to show only
> the keywords related to that specific user (the DB has an user_id).
>
> Any help is appreciated.
> AGD
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: