removed many posts association within group model
This commit is contained in:
parent
0417c53a4c
commit
b3d8f59c77
2 changed files with 1 additions and 14 deletions
|
|
@ -5,11 +5,9 @@ class Group
|
||||||
|
|
||||||
key :person_ids, Array
|
key :person_ids, Array
|
||||||
key :request_ids, Array
|
key :request_ids, Array
|
||||||
key :post_ids, Array
|
|
||||||
|
|
||||||
many :people, :in => :person_ids, :class_name => 'Person'
|
many :people, :in => :person_ids, :class_name => 'Person'
|
||||||
many :requests, :in => :request_ids, :class_name => 'Request'
|
many :requests, :in => :request_ids, :class_name => 'Request'
|
||||||
many :posts, :in => :post_ids, :class_name => 'Post'
|
|
||||||
|
|
||||||
belongs_to :user, :class_name => 'User'
|
belongs_to :user, :class_name => 'User'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,7 @@ describe Diaspora::Parser do
|
||||||
|
|
||||||
status_message = Factory.build(:status_message, :message => "hey!", :person => @person)
|
status_message = Factory.build(:status_message, :message => "hey!", :person => @person)
|
||||||
@user.receive status_message.to_diaspora_xml
|
@user.receive status_message.to_diaspora_xml
|
||||||
|
@user.posts.count.should == 1
|
||||||
|
|
||||||
# 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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue