Where did Builder::XmlMarkup go in Rails 2.1?

All,

I have a builder (.rxml) file that creates a new builder using:

  xml = Builder::XmlMarkup.new(:indent => 2)

When I attempt to render it, I get this exception:

  uninitialized constant ActionView::TemplateHandlers::Builder::XmlMarkup

so clearly Builder::XmlMarkup moved out from under ActionView::TemplateHandlers.

I looked at the directory structure in both 2.0.2 and 2.1.0 ActionPack gems and I can't figure out what's so different.

Where did Builder::XmlMarkup go and how do I bring it in?

Thanks, Wes

All,

I have a builder (.rxml) file that creates a new builder using:

xml = Builder::XmlMarkup.new(:indent => 2)

When I attempt to render it, I get this exception:

uninitialized constant ActionView::TemplateHandlers::Builder::XmlMarkup

does ::Builder::XmlMarkup work ?

Fred

Yes!

So how come Builder is now a root level module and not available
through ActionView::TemplateHandlers?

Because it always was at the root level. ActionView was significantly
refactored in 2.1; IIRC, TemplateHandler didn't exist before 2.1, so
there was no ActionView::TemplateHandlers::Builder. Now there is one
and since you're in the context of a TemplateHandler, ruby thinks that
Builder means ActionView::TemplateHandlers::Builder (which is the
TemplateHandler that allows you to write view with builder (much as
there are handlers that allow you to use, erb, rjs etc....) which is a
complete separate thing to Builder (as provided by the builder library).

  Fred

Because it always was at the root level. ActionView was significantly refactored in 2.1; IIRC, TemplateHandler didn't exist before 2.1, so there was no ActionView::TemplateHandlers::Builder. Now there is one and since you're in the context of a TemplateHandler, ruby thinks that Builder means ActionView::TemplateHandlers::Builder (which is the TemplateHandler that allows you to write view with builder (much as there are handlers that allow you to use, erb, rjs etc....) which is a complete separate thing to Builder (as provided by the builder library).

  Fred

That makes sense.

Is this a bug then?

Should Builder::XmlMarkup be moved into a new package given this namespace collision?

Wes

While it's unfortunate (and it's hard to foresee all combinations like this) I see this as namespacing working as it should. it would be more than a little odd to rename the builder library because of some rails implementation detail :slight_smile:

Fred