# Re: render\_component includes layout

**URL:** <https://www.ruby-forum.com/t/re-render-component-includes-layout/48579>\
**Category:** Rails\
**Created:** [November 18, 2005, 8:51am UTC](https://www.ruby-forum.com/t/re-render-component-includes-layout/48579 "2005-11-18T08:51:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oksteev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/919ad9/32.png) [@oksteev](https://www.ruby-forum.com/u/oksteev)\
**Post date:** [November 18, 2005, 8:51am UTC](https://www.ruby-forum.com/t/re-render-component-includes-layout/48579/1 "2005-11-18T08:51:17Z")

</div>

Matthew D. \<matt@…\> writes:

> or by calling render(:layout=\>false,…) in the action that creates the  
> component."
> 
> I’ve tried both of these and yet I still end up with the layout being  
> included in the output. The one thing that may be important is that the  
> controller I’m rendering is nested, i.e. I have:

I have this same problem…

calling render\_component :controller=\>x, :action=\>y with :layout =\>  
false or  
:layout =\> nil still renders the layout for that controller.

Is there any way to make it not render the layout ?

- steve dp

---

<div class="post-metadata">

**Author:** ![oksteev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/919ad9/32.png) [@oksteev](https://www.ruby-forum.com/u/oksteev)\
**Post date:** [November 18, 2005, 7:23pm UTC](https://www.ruby-forum.com/t/re-render-component-includes-layout/48579/2 "2005-11-18T19:23:23Z")

</div>

On Nov 17, 2005, at 10:59 PM, steve dp wrote:

> > actions used to render components from layout processing, either  
> > that the
> 
> - steve dp

Guys-

```
Here is how I get around this issue:

def x
    if params[:no_layout]
  do stuff....
  render :layout => false
   else
      do stuff ....
      render :layout => "x_tmpl"
   end
end

```

And then you can call the render\_component like this:

render\_component( :controller=\>x, :action=\>y, :params =\>  
{:no\_layout =\> true})

HTH-

-Ezra Z.  
Yakima Herald-Republic  
WebMaster

> **[yakimaherald.com | Yakima, Washington - We Tell Your Stories](https://www.yakimaherald.com/)**

509-577-7732  
removed\_email\_address@domain.invalid
