Wincent Colaiuta
2009-Feb-15 08:19 UTC
format.atom renders builder templates inside HTML application layout in 2.3.0
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wincent Colaiuta
2009-Feb-16 11:08 UTC
Re: format.atom renders builder templates inside HTML application layout in 2.3.0
On Feb 15, 9:19 am, Wincent Colaiuta <w...-uEs3UDB2KWBBDgjK7y7TUQ@public.gmane.org> 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---