Howto change @article.article.headline to @article.headline

I have to actions:

def index
@articles = Article.find(:all,
:conditions => “un_published != ‘1’”,
:order => “created_on desc”)
end

and

def group
id = params[:id]
@articles = ArticleGroup.find(:all,
:include => [:group, :article],
:conditions => [“articles.un_published != ‘1’ and groups.id =
?”, id],
:order => “articles.created_on desc”)
render :action => ‘index’
end

The “render :action” in the last one will not work off course, because
in the index.rhtml view I get the stuff from the array with
@article.headline, @article.ingress etc. and in the group action I
have to use @article.article.headline etc. I really don’t want to
write another view just because of this difference.

How can I avoid it?

Regards.
Henrik

The simplest way is to define a headline method on ArticleGroup

def headline
article.headline
end

-Jonny.

The “render :action” in the last one will not work off course, because
in the index.rhtml view I get the stuff from the array with
@article.headline, @article.ingress etc. and in the group action I
have to use @article.article.headline etc. I really don’t want to
write another view just because of this difference.

How can I avoid it?

Regards.
Henrik