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;
Était-ce utile?

La 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 "=".

Autres conseils

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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top