From 0aa268a62dcc0b70e19b51ba6db7e2a69202b1fa Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 29 Jul 2010 19:12:20 -0700 Subject: [PATCH] DG IZ trying asymetric searization and marshaling --- app/models/profile.rb | 5 +++++ lib/diaspora/diaspora_parser.rb | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/profile.rb b/app/models/profile.rb index 112e9d988..3098c1f52 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -27,6 +27,11 @@ class Profile def person_id self._parent_document.id end + + def person_id= id + person = Person.first(:id => id) + person.profile = self + end def to_diaspora_xml ""+ self.to_xml.to_s + "" diff --git a/lib/diaspora/diaspora_parser.rb b/lib/diaspora/diaspora_parser.rb index c40106e36..f617c5809 100644 --- a/lib/diaspora/diaspora_parser.rb +++ b/lib/diaspora/diaspora_parser.rb @@ -50,10 +50,7 @@ module Diaspora User.owner.receive_friend_request(p) #This line checks if the sender was in the database, among other things? elsif p.is_a? Profile - person = Person.first(:id => p.person_id) - person.profile = p - puts person.profile.save - puts person.save + puts p.save elsif p.respond_to?(:person) && !(p.person.nil?) && !(p.person.is_a? User) #WTF Rails.logger.info("Saving object with success: #{p.save}") end