base/app/models/activity_object.rb in social_stream-0.17.1 vs base/app/models/activity_object.rb in social_stream-0.18.0
- old
+ new
@@ -7,14 +7,13 @@
# {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
- # ActivityObject is a subtype of Channel
- # Author, owner and user_author of this ActivityObject are defined in its channel
- subtype_of :channel,
- :belongs => { :dependent => nil }
+ # See {SocialStream::Models::Channeled}
+ channeled
+
# ActivityObject is a supertype of SocialStream.objects
supertype_of :object
acts_as_taggable
@@ -25,12 +24,10 @@
scope :authored_by, lambda { |subject|
joins(:channel).merge(Channel.authored_by(subject))
}
- before_validation :check_existing_channel
-
# The object of this activity object
def object
subtype_instance.is_a?(Actor) ?
subtype_instance.subject :
subtype_instance
@@ -42,24 +39,7 @@
end
# Does this {ActivityObject} has {Actor}?
def acts_as_actor?
object_type == "Actor"
- end
-
- protected
-
- def check_existing_channel
- return unless channel!.new_record?
-
- existing_channel =
- Channel.
- where(:author_id => author_id,
- :owner_id => owner_id,
- :user_author_id => user_author_id).
- first
-
- return if existing_channel.blank?
-
- self.channel = existing_channel
end
end