我在视图中得到这个xml错误:
XML parse error: no element found
Location: http://localhost:3000/feed
Line 1, column 2:
我route.rb match '/feed' => 'konkurrancers#feed',
:as => :feed,
:defaults => { :format => 'xml' }
我的控制器:
def feed
@posts = Konkurrancer.all(:select => "name, tracking, id, created_at", :order => "created_at DESC", :limit => 20)
respond_to do |format|
format.html
format.rss { render :layout => false } #index.rss.builder
end
我index.rss.builder :
xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do
xml.channel do
xml.title "Your Blog Title"
xml.description "A blog about software and chocolate"
for konkurrancer in @posts
xml.item do
xml.title konkurrancer.name
xml.pubDate konkurrancer.posted_at.to_s(:rfc822)
xml.link konkurrancer.tracking
xml.guid konkurrancer.tracking
end
end
end
end
end
不是xml
,是rss
:
match '/feed' => 'konkurrancers#feed',
:as => :feed,
:defaults => { :format => 'rss' }