Ruby on Rails Wednesday, June 15, 2016

> On Jun 15, 2016, at 10:45 AM, Matt Martini <imaginarywave@gmail.com> wrote:
>
> 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.
>

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

> Matt
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/46CAD6BC-BDA8-4462-A390-82617BE8C32E%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/B737F22A-A61D-476B-9810-65E967DAD1D4%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment