Forum: Ruby on Rails Portal behaviour - beginner question

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.
43be2e1b4b5e8d236affc41a03800671?d=identicon&s=25 Fred (Guest)
on 2006-02-02 11:17
Hello,

I'm still reading the Pragmatic pdf for ROR. I intend to port a small
web-based soccer simulation game that a friend of mine wrote in php.

I still have in mind the basic cart application that can be found in the
pdf. The main pages in the game typically display multiple statistical
views (past games, player efficiency, ...)

In my basic mind, this would involve calling multiple controllers and so
on to fill the data required in the templates.. but that seems just
wrong to me... how would you do such a thing?

Best regards,

Fred
17cc8c944c49362c183fe253aa6c3e05?d=identicon&s=25 Tom Mornini (Guest)
on 2006-02-02 11:37
(Received via mailing list)
>I still have in mind the basic cart application that can be found in the
>pdf. The main pages in the game typically display multiple statistical
>views (past games, player efficiency, ...)
>
>In my basic mind, this would involve calling multiple controllers and so
>on to fill the data required in the templates.. but that seems just
>wrong to me... how would you do such a thing?

I would have a non-AR statistics class with one or more methods for each
view. I'd instantiate that statistics model in the controller, and use
render_partial
in the main view for each view.

Each view would reference the model, which would in turn compute the
statistics and return the values for inclusion the template, which in
turn
would be rendered into the main view.

If the statistics could easily be grouped into AR models cleanly, then
I'd
consider using AR model methods instead of the non-AR class.

--
-- Tom Mornini
43be2e1b4b5e8d236affc41a03800671?d=identicon&s=25 Fred (Guest)
on 2006-02-03 13:36
> I would have a non-AR statistics class with one or more methods for each
> view. I'd instantiate that statistics model in the controller, and use
> render_partial
> in the main view for each view.
forgive my stupidity, but what does AR stand for?

Fred
6992e8171ed4afa8b4ad4a8cef31fa29?d=identicon&s=25 Enrico Teotti (Guest)
on 2006-02-03 13:44
(Received via mailing list)
AR means active record,  on the ror book the cart it implemented as a
non AR class... If I rember well


--
"The only thing necessary for the triumph of evil
is for good men to do nothing"
 Edmund Burke
43be2e1b4b5e8d236affc41a03800671?d=identicon&s=25 Fred (Guest)
on 2006-02-06 18:09
Now, assuming that I have multiple controllers that render in the same
layout with statistics.
To have those statistics computed, I guess I could set up filters on my
controllers actions (to avoid having to explicitly call the computation
methods).

Do you think there is any other/better way to do this?

("statistics" might not have been the best word to express my needs, as,
for instance, this could be a menu block, a quote-of-the-day block, ...
"à la" Xoops/PhpNuke/Zope/...)
This topic is locked and can not be replied to.