Skip to content

Instantly share code, notes, and snippets.

@jpablobr
Created July 4, 2010 02:56
Show Gist options
  • Select an option

  • Save jpablobr/463057 to your computer and use it in GitHub Desktop.

Select an option

Save jpablobr/463057 to your computer and use it in GitHub Desktop.
class PostsController extends AppController {
var $name = 'Posts';
function random() {
$random = $this->Post->find('first',array(
'conditions' => array(
'Post.active'=>1,
),
'order' => 'rand()',
));
$this->view($random['Post']['id']);
$this->render('view');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment