Personally, I would just set it on an action basis.

public function edit($id) {
        $this->Model->id = $id;
}

Your getting into muddy territory going with that approach.

On Nov 18, 10:20 am, psybear83 <[email protected]> wrote:
> Hi all
>
> I'd like to have a beforeFilter in my AppController which - whenever
> the view, edit or delete is accessed - automatically fills the
> AppController::model variable with the data of the passed $id.
>
> So I need to get the ID of the model from the URL in the beforeFilter.
> Sadly the $this->params variable doesn't have any 'id' named passed
> parameter:
>
> Array
> (
>     [pass] => Array
>         (
>             [0] => 1
>         )
> )
>
> Is it safe just to use the key 0 or is there a way to put up a default
> route or something which would name the key? So I wouldn't be
> dependent from the order in which the ID is passed?
>
> Thanks
> Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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