I would like to render a partial template as a full template. The reason is that the partial contains content normally displayed via xhr and I want to display it also if my app degrades. The way I do this now is to have a full template containing one line like the below, but I''d rather do away with it because it seems a pointless one line file:- /app/views/my_controller/my_full_template.html.erb: <%= render :partial => "my_partial_template" %> I call this from the controller like this: render :action => :my_full_template What I''d like to do is render "my_partial_template" directly from the controller but render it as a full template so that it is displayed within my application layout. The following is one solution but I think it isn''t very elegant render :template => "my_controller/_my_partial_template)" Is there a better way to achieve this? Many thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 3 Apr 2008, at 20:48, John Lane wrote:> > What I''d like to do is render "my_partial_template" directly from the > controller but render it as a full template so that it is displayed > within my application layout. > > The following is one solution but I think it isn''t very elegant > render :template => "my_controller/_my_partial_template)" >You can just call render :partial => ''...'' in your controller. Fred> Is there a better way to achieve this? > > Many thanks. > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> You can just call render :partial => ''...'' in your controller.Fred, hi. You can indeed do that but that renders JUST the partial, it does not render the whole page layout like rendering a full template does. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
John Lane wrote:> Frederick Cheung wrote: >> You can just call render :partial => ''...'' in your controller. > > Fred, hi. You can indeed do that but that renders JUST the partial, it > does not render the whole page layout like rendering a full template > does.render :partial => ''...'', :layout => true maybe? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Alex Wayne wrote:> render :partial => ''...'', :layout => true > > maybe?Yes, that''s it! I wasn''t familiar with :layout => true. Thanks Alex! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---