Ruby on Rails Thursday, September 2, 2010

On Friday 03 September 2010, Michael Pavling wrote:
> On 2 September 2010 22:49, Michael Schuerig <michael@schuerig.de>
wrote:
> > Firstly, I've asked a similar question before[*]. I didn't get any
> > answers back then, maybe now I have better luck
>
> It's hard to answer your post, as your only question is in the
> subject. Everything else you typed was statement, so I can't be sure
> what bit you want addressed. But I'll assume (and please correct me
> if I'm wrong):
>
> Does "include" help your problem?
>
> @articles = Article.all(:include => :versions)
>
> (this would go in whatever controller action has a view that renders
> the articles/_article.html.erb partial with a collection @articles)

Then let me make the question completely explicit: How do I load several
articles with their latest versions from the database using only a
single request while retaining elegant code?

Michael

--
Michael Schuerig
mailto:michael@schuerig.de
http://www.schuerig.de/michael/

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment