# Format.atom renders builder templates inside HTML application layout in 2.3.0

**URL:** <https://www.ruby-forum.com/t/format-atom-renders-builder-templates-inside-html-application-layout-in-2-3-0/160355>\
**Category:** Rails\
**Created:** [February 15, 2009, 9:20am UTC](https://www.ruby-forum.com/t/format-atom-renders-builder-templates-inside-html-application-layout-in-2-3-0/160355 "2009-02-15T09:20:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wincent\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@Wincent\_C](https://www.ruby-forum.com/u/Wincent_C)\
**Post date:** [February 15, 2009, 9:20am UTC](https://www.ruby-forum.com/t/format-atom-renders-builder-templates-inside-html-application-layout-in-2-3-0/160355/1 "2009-02-15T09:20:31Z")

</div>

Given a builder template at “app/views/posts/index.atom.builder”, in  
2.2.2 my controller methods could render atom feeds like this:

format.atom { @posts = Post.find(:all) }

As of 2.3.0 RC1, that code produces unusable feeds because they get  
rendered _inside_ the application layout (HTML). So I now need to  
render like this:

format.atom {  
@posts = Post.find(:all)  
render :layout =\> false  
}

Is this a bug/regression in 2.3.0 RC1? Or was I just lucky in the past  
because the old behaviour was not intended?

And if the new behaviour _is_ intended, is there a way I can set a  
default layout (false) for the atom format in one single place,  
instead of having to do it explicitly in every action of every  
controller?

Cheers,  
Wincent

---

<div class="post-metadata">

**Author:** ![Wincent\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@Wincent\_C](https://www.ruby-forum.com/u/Wincent_C)\
**Post date:** [February 16, 2009, 12:09pm UTC](https://www.ruby-forum.com/t/format-atom-renders-builder-templates-inside-html-application-layout-in-2-3-0/160355/2 "2009-02-16T12:09:07Z")

</div>

On Feb 15, 9:19 am, Wincent C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> And if the new behaviour _is_ intended, is there a way I can set a  
> default layout (false) for the atom format in one single place,  
> instead of having to do it explicitly in every action of every  
> controller?

The workaround I’m currently testing is sticking this in my  
application\_controller.rb:

layout Proc.new { |controller| controller.send(:is\_atom?) ? false :  
‘application’ }

Where “is\_atom?” is just this method:

def is\_atom?  
params[:format] == ‘atom’  
end

Still wondering though, why this used to work pre-2.3.0 and what/why  
it has has changed all of a sudden…

> Is this a bug/regression in 2.3.0 RC1? Or was I just lucky in the past  
> because the old behaviour was not intended?

Cheers,  
Wincent
