Putting : in Builder Views


I am trying to add some of Apple’s custom iTunes podcasting extensions
to a
Rails generated feed and I have a builder question.

ITunes has attributes that look like this:


Well, the builder code:

xml.itunes:author “Test”

Of course doesn’t work since it doesn’t like the colon.

How can I get this to work? I haven’t had a lot of luck with the builder
doco so any help is appreciated very much.


HH ïèøåò:

First, Xml builder is a part of ActiveSupport library. You can find some
documentation in RDocs.

Then, it has method “tag!” that recieves a tag name as first argument:
xml.tag! “itunes:author”, “Test”

And at last, builder has a nice patch, that allows to treat tag name
(the method that you call on “xml” object) as a namespace if first
argument is a symbol (which will become a tag name):
xml.itunes :author, “Test”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs