Displaying 1 result from an estimated 1 matches for "activityfeeditem".
2009 Sep 27
1
Switchboard - Easy to use global ActiveRecord event listeners
...on
end
def after_destroy(record)
description = "#{record.class.name} was deleted"
publish_activity_feed_items record, description
end
def publish_activity_feed_items(record, description)
record.activity_feed_item_subscribers.each do |subscriber|
ActivityFeedItem.create :user => subscriber, :description =>
description
end
end
private :publish_activity_feed_items
end
end
Notice how these classes are almost identical to
ActiveRecord::Observer subclasses, designed so that it''s easy to
refactor from one to the other.
When unit...