Dashboard with multiple controllers

I have an application with items such as articles, bulletins, events,
weekly specials,… Each of these has its own MVC implmentation
and works well.

What I would like to do is have the home page display a dashboard that
contains many of these items, for example the last few articles,
a weekly special, upcoming events, and any bulletins with urgent news
for the users.

How do I go about getting all of these things to appear on the page and
in side bars? Can I just render them from the layout (this doesn’t seem
to work
but I could be doing it wrong), or use content_for?

Please point me in the right direction.

Matt

Please point me in the right direction.

A controller method should handle one request at a time, so maybe you
need to create a dashboard controller. That controller can call any
number of other models’ methods and collate the data together before
rendering one view.

A completely other approach would be to render these individual methods
as Ajax requests, and compose the resulting page with JavaScript. That’s
going to mean N-times as many requests to your server. You could do the
same with iframes, too, for an even lower-tech approach with the same
problem.

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