Search code examples
ruby-on-railsgetstream-io

Stream design, referring to additional objects


As I get deeper into developing our application, I'm starting to wonder if what I'm doing is correct.

We have a variety of different types of info we're sharing with our users, so the Object is the reference to the thing they're sharing (a TextBlock for text, a PhotoBlock for an image, etc).

These are being shared to a feed for a Workshop. So a user is subscribed to all the feeds for all the workshops they're involved with, so if someone shares a photo to a specific workshop feed, everyone in that workshop sees it.

The thing is that the timeline being shared to is also associated with an object, so I can show information from the workshop within the item's display. Originally, I associated the item in the target, but using StreamRails::Enrich doesn't seem to enrich the object, which makes me think that's not the way to do this.

So that brings me to the larger question: is this the right way to be doing what I'm trying to do? Should I manually enrich the object (or update the Enrich object so that it does)? Or am I thinking about this in a fundamentally flawed way?


Solution

  • I figured out why it's not finding the associated target: the model for Workshop has a different primary key field. Since the workshop exists in Salesforce, the primary key is sfid, not id, and the Enrich class seems to be searching based on the id in retrieve_objects: .where(id: ids.keys) .. instead it should be using Model.primary_key to determine the field to search on. I've fixed it and submitted a pull request.