Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ruby on rails how to render a page without layout and other head field

else   respond_to do |format|     format.html { render "tabelle/show" }   end end     

I want to render the page ...with only the code in that page....not add <head>...layout and <body> field in ruby on rails. I only want to show the result of code in the page tabelle/show.html.haml

like image 490
mewosic Avatar asked Apr 11 '13 12:04

mewosic


People also ask

How can you tell Rails to render without a layout?

By default, if you use the :text option, the text is rendered without using the current layout. If you want Rails to put the text into the current layout, you need to add the layout: true option.

How do you render partials?

Rendering a Partial View You can render the partial view in the parent view using the HTML helper methods: @html. Partial() , @html. RenderPartial() , and @html. RenderAction() .

What are partials in Rails?

A partial allows you to separate layout code out into a file which will be reused throughout the layout and/or multiple other layouts. For example, you might have a login form that you want to display on 10 different pages on your site.

How should you use nested layouts in rails?

Rails provides us great functionality for managing layouts in a web application. The layouts removes code duplication in view layer. You are able to slice all your application pages to blocks such as header, footer, sidebar, body and etc.


1 Answers

You can do it like this:

format.html { render "tabelle/show", :layout => false  }  
like image 197
fmendez Avatar answered Sep 25 '22 07:09

fmendez