Grouping ActiveRecord objects in a Facbook-wall-like way?

If you do the parsing in a helper, it wouldn't be ugly:).

That's true. I was going to do it in the controller, but keeping it out of there would be best. Still, it's more a question of the methodology of parsing, collecting, organizing that information elegantly.

I was looking for best practice, but there might not be one. I guess I'll just whack at it for now. – JohnMetta Dec 9 '11 at 19:55.

I don't quite understand what your inputs and outputs are (I'm just a simple Facebook user). I assume you have a list of items in an array. Each item has some kind of type.

Can you place a name for the type in the CSS class of the block for each item? Let the browser sort it out through some class on the list - container ("owners-only"). Use Enumerable#group_by, api.rubyonrails.org/classes/Enumerable.h....

The desire was to do this without a giant, explicit method, and to take advantage of functional programming methods. Matt Youell sent me a simple way to accomplish grouping items that have arrived within one minute using inject. Def group?(current, last) current.

Created_at - last. Created_at , , , , , #, , And would allow you to parse this list with something like: results. Each do |result| if result.

Class == Status # format a single entry else result. Class == Array # Enter the grouped formatting end end This, of course, could be expanded in many ways, including putting multiple logical groupings into group?(). Conceptually, it's what I was looking for.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions