Portal behaviour - beginner question


#1

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


#2

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 M.


#3

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


#4

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


#5

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/…)