Sha256: 5ed836b8f6b6068d2fad19c8a67bb07d4e5a4ecaa785ebd7882cb453f1b157fc

Contents?: true

Size: 1016 Bytes

Versions: 4

Compression:

Stored size: 1016 Bytes

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

        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))
        }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
social_stream-0.26.0 base/lib/social_stream/models/object.rb
social_stream-base-0.20.0 lib/social_stream/models/object.rb
social_stream-0.25.2 base/lib/social_stream/models/object.rb
social_stream-base-0.19.2 lib/social_stream/models/object.rb