First of all thanks for your efforts, then I have to add that I want direct calls to work so all three should work:
a.) /profiles/view/5 b.) /shouts/shout_to/5 c.) /shouts/index a.) should just include b.) and c.) without code duplication... and that's why I went for requestAction. If I cannot find a solution, I will probably merge things in the profiles controller's action, similar to what you suggested ... yes :/. On Oct 5, 8:49 pm, brian <bally.z...@gmail.com> wrote: > On Mon, Oct 5, 2009 at 2:47 PM, brian <bally.z...@gmail.com> wrote: > > Ordinarily, I'd suggest you dump the requestAction() calls and put the > > logic in your model and call it from there. But you need to paginate, > > so it has to be in the controller. In that case, you could put the > > pagination logic in ProfilesController. As for the shout_to() method, > > you could probably put that in the model. > > > public $uses = array('Profile', 'Shout'); > > > public paginate = array( > > 'Shout' => array( > > 'fields' => array( > > 'Shout.id', > > 'Shout.created', > > 'Shout.body', > > 'Shout.is_hidden', > > 'Shout.is_deleted', > > 'Shout.is_deleted_by_shouter', > > 'Shout.from_profile_id', > > 'FromProfile.nickname', > > ), > > 'contain' => array( > > 'FromProfile', > > ), > > 'conditions' => array('Shout.profile_id' => $profileId), > > 'order' => 'created DESC', > > 'limit' => 1 > > ) > > ); > > > function view($id = null) { > > if (!$id) { > > $this->Session->setFlash(__('Invalid Profile.', > > true)); > > $this->redirect(array('action'=>'index')); > > } > > $this->set('profile', $this->Profile->read(null, $id)); > > > $this->set('shouts', $this->paginate('Shout')); > > > $this->set('shoutbox', $this->Shout->shout_to($id)); > > } > > One thing I forgot: remove the conditions from the $paginate class var > and set in the action: > > $this->paginate['Shout']['conditions'] = array('Shout.profile_id' => > $profileId); --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---