Most obvious way to solve it, is to create CDbCriteria for Comment model (with copy of relational rules from Post) and pass it into CActiveDataProvider.
Is there any other normal way to make it work correctly? (In case of complex relation to avoid duplication of code)
Assuming that "Post HAS_MANY Comments" and the "comments" relation is properly declared in Post model, we can say 3 things in creating CActiveDataProvider for "Post":
There’s no need to specify “with” when you want lazy loading of comments.
You should also specify "together" to "true" when you want eager loading of comments.
You can not obtain the proper pagination when you set "together" to "true" … Try some searching in the forum for this problem.
@Evgeny:
For which model do you want CActiveDataProvider, "Post" or "Comment"?
And for which model do you want the pagesize, "Post" or "Comment"?
If both the answers are "Comments", then it should be quite easy …