1

I'm working on developing an activity stream for a running club I'm working with. Runners will be able to see all the fun and good things that they and their friends have been up to over the past few weeks.

Obie Fernandez gave a great talk on how to approach this using Redis at RailsConf 2012 (the videos on YouTube here) and I've adapted this to work within our app.

Having run it for a few days, it's clear my next challenge is to build aggregated items into this list now. Take for example the following feed:

The feed as it's implemented

Here it's clear that the top story would better collapse into something like "Shaun, Alexander and Ivo completed a Group Run...", but this poses an interesting question when thinking about comments. Currently a comment is associated with an individuals action of going on the run. So the comment on Ivo's attendance on the run are directed at him. In collapsing the story, I'm not entirely sure how to handle the commenting. It could be the comment then gets distributed amongst all the people you're friends with who went on the run, but I can see this very quickly becoming messy when people with have different sets of friends. The comments could instead just link directly back to the run itself, but then they lose the value of being able to reference a particular user's attendance.

I'd love to hear people's thoughts on this, and any pointers to good design patterns out there for handling this.

4

1 回答 1

1

我会考虑一个feed_item(出于显示目的)在多态关系中拥有_many feedables。也就是说,许多可以创造的事物feed_item(跑步、骑自行车、与新朋友联系都将是feedables 并生成 a feed_item

上面的运行将是 3 个运行都与 one 相关联feed_item,并且feed_item将有 many comments,而不是feedable(运行或其他)。

这将我的团体跑步记录与您的团体跑步记录隔离开来,因此当您离开服务时,我的跑步仍然存在,因为feed_item它仍然存在,它只是失去了您的feedable跑步。

对它们进行批处理和关联将采取一些模糊逻辑,这是一个不同的问题,但希望这可以帮助您解决评论和规范来源,它与s (跑步、自行车等)feed_item是分开的feedable

于 2013-05-08T20:07:40.557 回答