Sha256: e49daa5f8492727a27a95fe700346fe64e87426bd0cb0d137f04ad1463c1868c
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true module Timeful # An activity is something that happens in your application. It's comprised of an actor, an # action and an object. # # An example activity might be: "John Doe (actor) published (action) a new post (object)." # # @author Alessandro Desantis # # @abstract Subclass and override {#subscribers} to implement your own activity # # @example # class CommentCreatedActivity < Timeful::Activity # def subscribers # [object.post.author] # end # end class Activity < ApplicationRecord belongs_to :actor, polymorphic: true belongs_to :object, polymorphic: true # 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. # # @raise NotImplementedError def subscribers fail NotImplementedError end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
timeful-1.1.0 | app/models/timeful/activity.rb |
timeful-1.0.0 | app/models/timeful/activity.rb |
timeful-0.0.1 | app/models/timeful/activity.rb |