Gross, but hopefully temporary solution for namespaced classes and old versions of libxml

This commit is contained in:
Raphael Sofaer 2011-05-23 16:24:28 -07:00
parent 6b094b2f35
commit e28ec16781
2 changed files with 3 additions and 2 deletions

View file

@ -5,7 +5,7 @@
class ActivityStreams::Photo < Post
include Diaspora::Socketable
xml_name "activity_streams::_photo"
xml_name self.name.underscore.gsub!('/', '-')
xml_attr :image_url
xml_attr :image_height
xml_attr :image_width

View file

@ -7,7 +7,8 @@ module Diaspora
def self.from_xml(xml)
doc = Nokogiri::XML(xml) { |cfg| cfg.noblanks }
return unless body = doc.xpath("/XML/post").children.first
body.name.camelize.constantize.from_xml body.to_s
class_name = body.name.gsub('-', '/')
class_name.camelize.constantize.from_xml body.to_s
end
end
end