Skip to content

Instantly share code, notes, and snippets.

@litch
litch / feed_item_generator.rb
Last active December 10, 2015 11:48
I'm trying to decide what's the best way to build this out. Basically I'm going to observe all kinds of events in the system and create feed items for users based on a number of criteria - "John changed the Status of Job: JUE-923 to active". I'm facing a diliema on how to build the actual FeedItemGenerator part. Below are two ways and how they w…
#This works but is maybe not so great.
class FeedItemGenerator
include ActionView::Helpers
attr_accessor :feedable
attr_accessor :user
attr_accessor :event
def initialize(feedable, user, event=nil)
@feedable = feedable