Sha256: 6987d3eaffd609f9913bd134779233fbd976747d0e0dff19d872739178805a10
Contents?: true
Size: 1.67 KB
Versions: 8
Compression:
Stored size: 1.67 KB
Contents
module SocialStream module Models # Additional features for models that are Activity Objects module Object extend ActiveSupport::Concern included do subtype_of :activity_object, :build => { :object_type => to_s } has_many :received_actions, :through => :activity_object has_many :activity_object_audiences, :through => :activity_object unless self == Actor validates_presence_of :author_id, :owner_id, :user_author_id after_create :create_post_activity # Disable update activity for now # It usually appears repeated in the wall and provides no useful information #after_update :create_update_activity end scope :authored_by, lambda { |subject| joins(:activity_object). merge(ActivityObject.authored_by(subject)) } scope :not_authored_by, lambda { |subject| joins(:activity_object). merge(ActivityObject.not_authored_by(subject)) } scope :owned_by, lambda { |subject| joins(:activity_object). merge(ActivityObject.owned_by(subject)) } scope :shared_with, lambda { |subject| joins(:activity_object). merge(ActivityObject.shared_with(subject)) } scope :followed_by, lambda { |subject| joins(:activity_object). merge(ActivityObject.followed_by(subject)) } end module ClassMethods # Nothing here by the moment, but methods are added by other # SocialStream's components, such as Ostatus end end end end
Version data entries
8 entries across 8 versions & 2 rubygems