Question

My question seems to be not very complicated. I need in "-" in my xml builder file

xml.instruct! :xml, :version => "1.0", :encoding => "windows-1251"             
xml.autos do               
   xml.auto-list do
     @autos.each do |offer|
     xml.offer do
     end
end
end
end

but

undefined method `list' for #<#<Class:0xb32881c>:0xbc96f84>

also, i tried

&ndash; &#8211; and &amp;ndash;
Was it helpful?

Solution

You are trying to call a method "auto-list" on your "xml" object, but this is not a a valid method name, because of the dash.

Method names can only contain the following: letters, numbers, underscores, "?", "!" and "=".

OTHER TIPS

The easiest way is to just use the "tag!" command, like this:

xml.autos do               
  xml.tag! 'auto-list' do
    @autos.each do |offer|
      xml.offer do
      end
    end
  end
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top