I'm sure this is a simple fix, but I'm stuck scratching my head. I'm
using an example posted here:
http://kete.lighthouseapp.com/projects/14288/tickets/177-tags-list-rss-feed-increasingly-slower
I'm on Rails 3.0.1 and Ruby 1.9.2, Nokogiri 1.4.3.1. Maybe I'm just
following an older example and things have changed for Rails 3? Here's
the code in my photos.xml.erb file:
<%= Nokogiri::XML::Builder.new(:encoding => 'UTF-8') { |xml|
xml.photos {
for photo in @photos
xml.photo {
xml.id photo[:id]
xml.title photo[:title]
xml.description { xml.cdata photo[:description] }
xml.created_at photo[:created_at]
xml.file_file_name photo[:file_file_name]
xml.file_file_size photo[:file_file_size]
xml.has_adult_content photo[:has_adult_content]
xml.is_altered photo[:is_altered]
xml.is_popular photo[:is_popular]
xml.lat photo[:lat]
xml.long photo[:long]
xml.num_downloads photo[:num_downloads]
xml.num_likes photo[:num_likes]
xml.tags {
for tag in photo.tags
xml.tag {
xml.id tag[:id]
xml.name tag[:name]
}
end
}
}
end
}
}.to_xml
%>
And this is what it generates, all html-encoded characters instead of
XML tags:
<?xml version="1.0" encoding="UTF-8"?>
<photos>
<photo>
<id>3</id>
<title>tsetset</title>
<description><![CDATA[testing]]></description>
<created_at>2010-11-08 07:07:34 UTC</created_at>
<file_file_name>00462075a788ec72822bb26dc62320ef.jpg</
file_file_name>
<file_file_size>142683</file_file_size>
<has_adult_content>false</has_adult_content>
<is_altered>true</is_altered>
<is_popular></is_popular>
<lat></lat>
<long></long>
<num_downloads></num_downloads>
<num_likes></num_likes>
<tags>
<tag>
<id>1</id>
<name>asdf</name>
</tag>
<tag>
<id>4</id>
<name>ass face</name>
</tag>
<tag>
<id>5</id>
<name>black</name>
</tag>
<tag>
<id>6</id>
<name>chargers</name>
</tag>
<tag>
<id>7</id>
<name>poppy pants</name>
</tag>
</tags>
</photo>
</photos>
Any ideas? Thanks!