1

I get this xml error in view:

XML parse error: no element found
Location: http://localhost:3000/feed
Line 1, column 2:

My route.rb

match '/feed' => 'konkurrancers#feed',
      :as => :feed,
      :defaults => { :format => 'xml' }

My controller:

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

My 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

1 Answer 1

1

it's not xml, it's rss:

match '/feed' => 'konkurrancers#feed',
      :as => :feed,
      :defaults => { :format => 'rss' }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.