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

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.
Mario P. (Guest)
on 2008-11-07 07: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
Mario
Thorsten M. (Guest)
on 2008-11-07 12:21
(Received via mailing list)
Just as you say. Nothing special about requesting data from lots of
different
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.