# Where did Builder::XmlMarkup go in Rails 2.1?

**URL:** <https://www.ruby-forum.com/t/where-did-builder-xmlmarkup-go-in-rails-2-1/140320>\
**Category:** Rails\
**Created:** [June 12, 2008, 11:08pm UTC](https://www.ruby-forum.com/t/where-did-builder-xmlmarkup-go-in-rails-2-1/140320 "2008-06-12T23:08:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 12, 2008, 11:08pm UTC](https://www.ruby-forum.com/t/where-did-builder-xmlmarkup-go-in-rails-2-1/140320/1 "2008-06-12T23:08:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 12, 2008, 11:45pm UTC](https://www.ruby-forum.com/t/where-did-builder-xmlmarkup-go-in-rails-2-1/140320/2 "2008-06-12T23:45:54Z")

</div>

On Jun 12, 10:08 pm, Wes G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 

does ::Builder::XmlMarkup work ?

Fred

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 12, 2008, 11:51pm UTC](https://www.ruby-forum.com/t/where-did-builder-xmlmarkup-go-in-rails-2-1/140320/3 "2008-06-12T23:51:57Z")

</div>

Yes!

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

Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 13, 2008, 12:23am UTC](https://www.ruby-forum.com/t/where-did-builder-xmlmarkup-go-in-rails-2-1/140320/4 "2008-06-13T00:23:15Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 13, 2008, 12:17am UTC](https://www.ruby-forum.com/t/where-did-builder-xmlmarkup-go-in-rails-2-1/140320/5 "2008-06-13T00:17:01Z")

</div>

On 12 Jun 2008, at 22:51, Wes G. wrote:

> 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

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 13, 2008, 12:49am UTC](https://www.ruby-forum.com/t/where-did-builder-xmlmarkup-go-in-rails-2-1/140320/6 "2008-06-13T00:49:53Z")

</div>

On 12 Jun 2008, at 23:23, Wes G. wrote:

> > 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?

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 🙂

Fred
