What's the rails way to display data from multiple models on one page

Hi there,

I’m working on a little portfolio-site to get to know rails a little
better.
On this site I have a blog, a gallery (my portfolio) and other stuff for
which each I created a model. On the start-page I want to show a bit of
everything - some of the recent blog-entries, some pictures from the
gallery
and so on. Now I was wondering - what’s the rails way to do this? Would
you
just create a controller and a view and load the data from multiple
models
(blog, gallery, …) in the controller? Or would you create a new model
that
just has_many of the other models? Are there other, better ways? How
would
you accomplish this in rails?

Thanks in advance,
Luke

On Jan 21, 2011, at 1:49 PM, Luke wrote:

that just has_many of the other models? Are there other, better
ways? How would you accomplish this in rails?

Thanks in advance,
Luke

I usually make a home_controller, map my :root to one of its methods,
and load up whatever models I need inside that method. I generally use
that same controller for site-wide things like search results or
contact us or about this site.

Walter

Ok, thanks Walter!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs