Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

Expand Down Expand Up @@ -408,7 +418,7 @@ For convenience we include a basic view:
</div>
```

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

Expand Down