app/models/group.rb in social_stream-0.3.3 vs app/models/group.rb in social_stream-0.3.4

- old
+ new

@@ -1,19 +1,38 @@ class Group < ActiveRecord::Base attr_accessor :_founder + attr_accessor :_participants def followers subjects(:subject_type => :user, :direction => :senders) end after_create :create_founder - + after_create :create_participants + + private + #Creates the ties betwbeen the group and the founder def create_founder founder = Actor.find_by_permalink(_founder) || raise("Cannot create group without founder") sent_ties.create! :receiver => founder, :relation => relations.sort.first end -end + + #Creates the ties betwbeen the group and the participants + def create_participants + + return if @_participants.blank? + + @_participants.each do |participant| + + participantActor = Actor.find_by_id(participant.to_i) + sent_ties.create! :receiver => participantActor, + :relation => relations.sort.first + end + + end + +end \ No newline at end of file