Sha256: 18116787f904b72be38c64673801b55c423dd68869574bd90aaa2fa13ef94f0b
Contents?: true
Size: 1.82 KB
Versions: 8
Compression:
Stored size: 1.82 KB
Contents
# The {ActivityObject} is any object that receives actions. Examples are # creating post, liking a comment, contacting a user. # # = ActivityObject subtypes # All post, comment and user are {SocialStream::Models::Object objects}. # Social Stream privides 3 {ActivityObject} subtypes, {Post}, {Comment} and # {Actor}. The application developer can define as many {ActivityObject} subtypes # as required. # Objects are added to +config/initializers/social_stream.rb+ # class ActivityObject < ActiveRecord::Base # See {SocialStream::Models::Channeled} channeled # ActivityObject is a supertype of SocialStream.objects supertype_of :object acts_as_taggable has_many :activity_object_activities, :dependent => :destroy has_many :activities, :through => :activity_object_activities has_many :activity_object_properties, :dependent => :destroy has_many :object_properties, :through => :activity_object_properties, :source => :property has_many :activity_object_holders, :class_name => "ActivityObjectProperty", :foreign_key => :property_id, :dependent => :destroy has_many :object_holders, :through => :activity_object_holders, :source => :activity_object validates_presence_of :object_type scope :authored_by, lambda { |subject| joins(:channel).merge(Channel.authored_by(subject)) } # The object of this activity object def object subtype_instance.is_a?(Actor) ? subtype_instance.subject : subtype_instance end # The activity in which this activity_object was created def post_activity activities.includes(:activity_verb).where('activity_verbs.name' => 'post').first end # Does this {ActivityObject} has {Actor}? def acts_as_actor? object_type == "Actor" end def object_holder_hash end end
Version data entries
8 entries across 8 versions & 2 rubygems