removed many posts association within group model

This commit is contained in:
ilya 2010-08-16 15:51:31 -07:00
parent 0417c53a4c
commit b3d8f59c77
2 changed files with 1 additions and 14 deletions

View file

@ -5,11 +5,9 @@ class Group
key :person_ids, Array
key :request_ids, Array
key :post_ids, Array
many :people, :in => :person_ids, :class_name => 'Person'
many :requests, :in => :request_ids, :class_name => 'Request'
many :posts, :in => :post_ids, :class_name => 'Post'
belongs_to :user, :class_name => 'User'

View file

@ -19,18 +19,7 @@ describe Diaspora::Parser do
status_message = Factory.build(:status_message, :message => "hey!", :person => @person)
@user.receive status_message.to_diaspora_xml
# mongomapper doesn't support joins, meaning we can't do a query
# on user.groups.
# should this code below be a function of a user?
# something like self.find_group_for(friend_id) ?
groups = @user.groups
groups.shift while not groups[0].person_ids.include?(@person.id)
group = groups[0]
####
@group.posts.count.should == 1
@user.posts.count.should == 1
end