DG IZ assiging the new profile to the person in the parse objects from xml

This commit is contained in:
ilya 2010-07-29 19:23:05 -07:00
parent 0aa268a62d
commit abc5ee412d
2 changed files with 10 additions and 7 deletions

View file

@ -27,11 +27,6 @@ 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
"<post>"+ self.to_xml.to_s + "</post>"

View file

@ -24,7 +24,12 @@ module Diaspora
object = post.name.camelize.constantize.from_xml post.to_s
if object.respond_to? :person
object.person = parse_owner_from_xml post.to_s
end
elsif object.is_a? Profile
puts "got into parse objects from xml PROFILE"
person = parse_owner_id_from_xml post
person.profile = object
person.save
end
objects << object
#elsif object.is_a? Profile
# person = parse_owner_id_from_xml post
@ -50,7 +55,10 @@ 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
puts p.save
puts p.person_id
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