Hi. This is what I mean: Let''s consider a ''show'' action called by URLs of the form: "GET /posts/ 42" In this project, this action can be either called directly or within a page with XHR (ajax). Is there a pretty way to render the page within the layout when it''s a direct call, and without it when it''s an XHR call? Thank you... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 7/9/07, Aurélien Malisart <aurelien.malisart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi. This is what I mean: > Let''s consider a ''show'' action called by URLs of the form: "GET /posts/ > 42" > In this project, this action can be either called directly or within a > page with XHR (ajax). Is there a pretty way to render the page within > the layout when it''s a direct call, and without it when it''s an XHR > call? > > Thank you... > > > > >class FooController layout :select_layout private def select_layout return nil if request.xhr? "my_layout" end end Though if you''re getting an xhr request shouldn''t you be returning javascript anyway? There''d be no layout for that. Pat --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks!> Though if you''re getting an xhr request shouldn''t you be returning > javascript anyway? There''d be no layout for that.In that case, i''m returning the rendering of a partial (a form). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---