Forum: Ruby on Rails Different renders on main page...

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
505db8e9da687ac983e3caf44d86aff2?d=identicon&s=25 Mario Peterscheck (panatura)
on 2008-11-07 06:34
Hi all,

just want to know how to act:

It's some kind of community website and at the main site I want to have
different boxes with information from differen models -> new users, new
news, etc.

How to set up? Do I need to render partials in each div, therefore I
need to set instances, do I?

In fact it's nothing more than requesting one controller (at index_url)
with some models?

How do you do? What do you think about that?

Kind regards
2d8132658d56e51f19ace1c68e48b6aa?d=identicon&s=25 Thorsten Mueller (thorsten)
on 2008-11-07 11:21
(Received via mailing list)
Just as you say. Nothing special about requesting data from lots of
or unrelated models for such usage.

In the controller get the data like:

@new_users = User.find(:all, :conditions => *whatever means new*)
@new_news = News.find(:all, :conditions => ...)

In the view it's a matter of taste if you write a different partial
for each box or not. I would most likely do it, or reuse some other
partials for displaying users or new, that are already written.
This topic is locked and can not be replied to.