Forum: Ruby on Rails Howto change @article.article.headline to @article.headline

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Henrik =?iso-8859-1?Q?Orm=E5sen?= (Guest)
on 2006-01-30 16:02
(Received via mailing list)
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 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 Ormåsen
This topic is locked and can not be replied to.