I have models Page and Commit. Page has many Commits. But sometimes i need to get just one last commit for page, and sometimes to get history of page commits (20 last or all).
I wrote this code for models:
class Page extends ActiveRecord\Model {
static $has_many = array(
array('commits',
'select'=> 'content',
'order' => 'id DESC',
'limit' => 1
));
}
class Commit extends ActiveRecord\Model {
static $belongs_to = array(
array('page'));
}
So what i need to do to have a chance for display all commits (['limit' => 20] for ex.)?