relation with findByAttributes

Post::model()->with(‘author’,‘comments’)->findAll();

is that possible to do that way like this ?

Post::model()->with(‘author’)->findbyPk($id)->author_name;

it will return value of "author_name"

but i tried it and return nothing ??

can you give me a solution ?

just do $model=Post::model()->findAll()

in the view

foreach($model as $post){

echo $post->author->author_name

foreach($post->comments as $comment){

echo $comment

}

}

Yes you right, but i thhought that i can call the attr with the quick way like what i said,

but indeed thats what i mean . .

Thanx Alex :D