Class: Timeful::Activity Abstract

Inherits:
ApplicationRecord show all
Defined in:
app/models/timeful/activity.rb

Overview

This class is abstract.

Subclass and override #subscribers to implement your own activity

An activity is something that happens in your application. It’s comprised of an actor, an action and an target.

An example activity might be: “John Doe (actor) published (action) a new post (target).”

Examples:

class CommentCreatedActivity < Timeful::Activity
  def subscribers
    [target.post.author]
  end
end

Author:

  • Alessandro Desantis

Instance Method Summary collapse

Instance Method Details

#subscribersObject

Returns the users that subscribe to this activity. A FeedItem linked to the activity will be created for these users.

The returned value can be an instance of either ActiveRecord::Relation or Array. The former is preferred when the subscribers list is very long, as we’ll automatically use find_each to reduce memory usage if it’s available.

Raises:

  • NotImplementedError



32
33
34
# File 'app/models/timeful/activity.rb', line 32

def subscribers
  fail NotImplementedError
end