From 52c063cc8d6d3d88cd49ae16e593e9079dbe82e7 Mon Sep 17 00:00:00 2001 From: Ryan Romanchuk Date: Mon, 23 Apr 2018 16:17:42 -0700 Subject: [PATCH] Be a lot more explicit with how the enricher worker, fix incorrect default location for aggregate activities --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 91171f4..5a11701 100644 --- a/README.md +++ b/README.md @@ -334,7 +334,7 @@ When you read data from feeds, a pin activity will look like this: ``` This is far from ready for usage in your template. We call the process of loading the references from the database -enrichment. An example is shown below: +enrichment. An example for a flat newsfeed is shown below: ```ruby enricher = StreamRails::Enrich.new @@ -344,6 +344,16 @@ results = feed.get()['results'] activities = enricher.enrich_activities(results) ``` +or for an aggregated feed: + +```ruby +enricher = StreamRails::Enrich.new + +feed = StreamRails.feed_manager.get_news_feeds(current_user.id)[:timeline_aggregated] +results = feed.get()['results'] +activities = enricher.enrich_aggregated_activities(results) +``` + If you have additional metadata in your activity (by overriding `activity_extra_data` in the class where you add the Stream Activity mixin), you can also enrich that field's data by doing the following: @@ -408,7 +418,7 @@ For convenience we include a basic view: ``` -The ```render_activity``` view helper will render the activity by picking the partial ```activity/_pin``` for a pin activity, ```aggregated/_follow``` for an aggregated activity with verb follow. +The ```render_activity``` view helper will render the activity by picking the partial ```activity/_pin``` for a pin activity, ```aggregated_activity/_follow``` for an aggregated activity with verb follow. The helper will automatically send ```activity``` to the local scope of the partial; additional parameters can be send as well as use different layouts, and prefix the name